#include <psync.h>
Public Member Functions | |
| PWaitAndSignal (const PSync &sem, PBoolean wait=PTrue) | |
| ~PWaitAndSignal () | |
Protected Attributes | |
| PSync & | sync |
This is very useful for constructs such as:
void func()
{
PWaitAndSignal mutexWait(myMutex);
if (condition)
return;
do_something();
if (other_condition)
return;
do_something_else();
}
Create the semaphore wait instance. This will wait on the specified semaphore using the Wait() function before returning.
| sem | Semaphore descendent to wait/signal. |
| wait | Wait for semaphore before returning. |
| PWaitAndSignal::~PWaitAndSignal | ( | ) | [inline] |
Signal the semaphore. This will execute the Signal() function on the semaphore that was used in the construction of this instance.
PSync& PWaitAndSignal::sync [protected] |
1.5.1