|
PTLib
Version 2.18.8
|
This class starts a write operation for the PReadWriteMutex on construction and automatically ends the write operation on destruction. More...
#include <syncthrd.h>


Public Member Functions | |
| PWriteWaitAndSignal (const PReadWriteMutex &mutex, PBoolean start=true) | |
| Create the PWriteWaitAndSignal wait instance. More... | |
Public Member Functions inherited from PReadWriteWaitAndSignalBase | |
| ~PReadWriteWaitAndSignalBase () | |
Additional Inherited Members | |
Protected Types inherited from PReadWriteWaitAndSignalBase | |
| typedef void(PReadWriteMutex::* | StartFn )(const PDebugLocation *location) |
| typedef void(PReadWriteMutex::* | EndFn )(const PDebugLocation *location) |
Protected Member Functions inherited from PReadWriteWaitAndSignalBase | |
| PReadWriteWaitAndSignalBase (const PReadWriteMutex &mutex, const PDebugLocation *location, StartFn start, EndFn end) | |
Protected Attributes inherited from PReadWriteWaitAndSignalBase | |
| PReadWriteMutex & | m_mutex |
| PDebugLocation | m_location |
| EndFn | m_end |
This class starts a write operation for the PReadWriteMutex on construction and automatically ends the write operation on destruction.
This is very useful for constructs such as:
void func()
{
PWriteWaitAndSignal mutexWait(myMutex);
if (condition)
return;
do_something();
if (other_condition)
return;
do_something_else();
}
|
inline |
Create the PWriteWaitAndSignal wait instance.
This will wait on the specified PReadWriteMutex using the StartWrite() function before returning.
| mutex | PReadWriteMutex descendent to wait/signal. |
| start | Start write operation on PReadWriteMutex before returning. |