Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

void PReadWriteMutex::StartRead (  ) 

This function attempts to acquire the mutex for reading. This call may be nested and must have an equal number of EndRead() calls for the mutex to be released.

Definition at line 2390 of file osutils.cxx.

Referenced by PSafeObject::LockReadOnly(), and PReadWaitAndSignal::PReadWaitAndSignal().

{
  // Get the nested thread info structure, create one it it doesn't exist
  Nest & nest = StartNest();

  // One more nested call to StartRead() by this thread, note this does not
  // need to be mutexed as it is always in the context of a single thread.
  nest.readerCount++;

  // If this is the first call to StartRead() and there has not been a
  // previous call to StartWrite() then actually do the text book read only
  // lock, otherwise we leave it as just having incremented the reader count.
  if (nest.readerCount == 1 && nest.writerCount == 0)
    InternalStartRead();
}


Generated by  Doxygen 1.6.0   Back to index