PTLib
Version 2.14.3
|
This is a PCondMutex for which the conditional is the value of an integer. More...
#include <syncthrd.h>
Public Member Functions | |
Overrides from class PObject | |
void | PrintOn (ostream &strm) const |
Print the object on the stream. More... | |
Condition access functions | |
virtual PBoolean | Condition () |
This is the condition that must be met for the WaitCondition() function to acquire the mutex. More... | |
operator int () const | |
Get the current value of the condition variable. More... | |
PIntCondMutex & | operator= (int newval) |
Assign new condition value. More... | |
PIntCondMutex & | operator++ () |
Increment condition value. More... | |
PIntCondMutex & | operator+= (int inc) |
Add to condition value. More... | |
PIntCondMutex & | operator-- () |
Decrement condition value. More... | |
PIntCondMutex & | operator-= (int dec) |
Subtract from condition value. More... | |
![]() | |
virtual void | WaitCondition () |
This function attempts to acquire the mutex, but will block not only until the mutex is free, but also that the condition returned by the Condition() function is also met. More... | |
virtual void | Signal () |
If there are waiting (blocked) threads then unblock the first one that was blocked. More... | |
virtual void | OnWait () |
This function is called immediately before blocking on the condition in the WaitCondition() function. More... | |
Protected Attributes | |
int | value |
int | target |
Operation | operation |
![]() | |
PSyncPoint | syncPoint |
Construction | |
enum | Operation { LT, LE, EQ, GE, GT } |
defines possible operators on current value and target value More... | |
PIntCondMutex (int value=0, int target=0, Operation operation=LE) | |
Create a cond mutex using an integer. More... | |
This is a PCondMutex for which the conditional is the value of an integer.
Create a cond mutex using an integer.
value | initial value if the integer |
target | target vaue which causes the mutex to unlock |
operation | comparison operator |
|
virtual |
This is the condition that must be met for the WaitCondition() function to acquire the mutex.
Implements PCondMutex.
|
inline |
Get the current value of the condition variable.
References value.
PIntCondMutex& PIntCondMutex::operator++ | ( | ) |
Increment condition value.
Use the Wait() function to acquire the mutex, modify the value, then release the mutex, possibly releasing the thread in the WaitCondition() function if the condition was met by the operation.
PIntCondMutex& PIntCondMutex::operator+= | ( | int | inc | ) |
Add to condition value.
Use the Wait() function to acquire the mutex, modify the value, then release the mutex, possibly releasing the thread in the WaitCondition() function if the condition was met by the operation.
PIntCondMutex& PIntCondMutex::operator-- | ( | ) |
Decrement condition value.
Use the Wait() function to acquire the mutex, modify the value, then release the mutex, possibly releasing the thread in the WaitCondition() function if the condition was met by the operation.
PIntCondMutex& PIntCondMutex::operator-= | ( | int | dec | ) |
Subtract from condition value.
Use the Wait() function to acquire the mutex, modify the value, then release the mutex, possibly releasing the thread in the WaitCondition() function if the condition was met by the operation.
PIntCondMutex& PIntCondMutex::operator= | ( | int | newval | ) |
Assign new condition value.
Use the Wait() function to acquire the mutex, modify the value, then release the mutex, possibly releasing the thread in the WaitCondition() function if the condition was met by the operation.
void PIntCondMutex::PrintOn | ( | ostream & | strm | ) | const |
Print the object on the stream.
This will be of the form #"(value < target)"#.
|
protected |
|
protected |
|
protected |
Referenced by operator int().