Commit 6913d805 authored by unknown's avatar unknown
Browse files

ndb -

  fix bug in MemoryChannel


ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp:
  Don't signal when reporting to NDBFS
ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp:
  1) add new method which don't signal
  2) remove wait(0) from tryReadChannel
parent 5285b530
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -226,7 +226,9 @@ AsyncFile::run()
      abort();
      break;
    }//switch
    theReportTo->writeChannel(request);
    
    // No need to signal as ndbfs only uses tryRead
    theReportTo->writeChannelNoSignal(request);
  }//while
}//AsyncFile::run()

+11 −3
Original line number Diff line number Diff line
@@ -84,7 +84,8 @@ public:
  MemoryChannel( int size= 256);
  virtual ~MemoryChannel( );

  virtual void writeChannel( T *t);
  void writeChannel( T *t);
  void writeChannelNoSignal( T *t);
  T* readChannel();
  T* tryReadChannel();

@@ -127,6 +128,15 @@ template <class T> void MemoryChannel<T>::writeChannel( T *t)
  NdbCondition_Signal(theConditionPtr);
}

template <class T> void MemoryChannel<T>::writeChannelNoSignal( T *t)
{

  NdbMutex_Lock(theMutexPtr);
  if(full(theWriteIndex, theReadIndex) || theChannel == NULL) abort();
  theChannel[theWriteIndex]= t;
  ++theWriteIndex;
  NdbMutex_Unlock(theMutexPtr);
}

template <class T> T* MemoryChannel<T>::readChannel()
{
@@ -149,8 +159,6 @@ template <class T> T* MemoryChannel<T>::tryReadChannel()
{
  T* tmp= 0;
  NdbMutex_Lock(theMutexPtr);
  NdbCondition_WaitTimeout(theConditionPtr,
                        theMutexPtr, 0);
  if ( !empty(theWriteIndex, theReadIndex) )
  {     
    tmp= theChannel[theReadIndex];