Commit 6913d805 authored by unknown's avatar unknown

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
...@@ -226,7 +226,9 @@ AsyncFile::run() ...@@ -226,7 +226,9 @@ AsyncFile::run()
abort(); abort();
break; break;
}//switch }//switch
theReportTo->writeChannel(request);
// No need to signal as ndbfs only uses tryRead
theReportTo->writeChannelNoSignal(request);
}//while }//while
}//AsyncFile::run() }//AsyncFile::run()
......
...@@ -84,7 +84,8 @@ public: ...@@ -84,7 +84,8 @@ public:
MemoryChannel( int size= 256); MemoryChannel( int size= 256);
virtual ~MemoryChannel( ); virtual ~MemoryChannel( );
virtual void writeChannel( T *t); void writeChannel( T *t);
void writeChannelNoSignal( T *t);
T* readChannel(); T* readChannel();
T* tryReadChannel(); T* tryReadChannel();
...@@ -127,6 +128,15 @@ template <class T> void MemoryChannel<T>::writeChannel( T *t) ...@@ -127,6 +128,15 @@ template <class T> void MemoryChannel<T>::writeChannel( T *t)
NdbCondition_Signal(theConditionPtr); 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() template <class T> T* MemoryChannel<T>::readChannel()
{ {
...@@ -149,8 +159,6 @@ template <class T> T* MemoryChannel<T>::tryReadChannel() ...@@ -149,8 +159,6 @@ template <class T> T* MemoryChannel<T>::tryReadChannel()
{ {
T* tmp= 0; T* tmp= 0;
NdbMutex_Lock(theMutexPtr); NdbMutex_Lock(theMutexPtr);
NdbCondition_WaitTimeout(theConditionPtr,
theMutexPtr, 0);
if ( !empty(theWriteIndex, theReadIndex) ) if ( !empty(theWriteIndex, theReadIndex) )
{ {
tmp= theChannel[theReadIndex]; tmp= theChannel[theReadIndex];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment