AGENT++
4.0.3
|
The Synchronized class implements services for synchronizing access between different threads. More...
#include <threads.h>
Public Types | |
enum | TryLockResult { LOCKED = 1, BUSY = 0, OWNED = -1 } |
Public Member Functions | |
Synchronized () | |
~Synchronized () | |
void | wait () |
Causes current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object. | |
bool | wait (unsigned long timeout) |
Causes current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed. | |
void | notify () |
Wakes up a single thread that is waiting on this object's monitor. | |
void | notify_all () |
Wakes up all threads that are waiting on this object's monitor. | |
bool | lock () |
Enter a critical section. | |
TryLockResult | trylock () |
Try to enter a critical section. | |
bool | unlock () |
Leave a critical section. | |
The Synchronized class implements services for synchronizing access between different threads.
Synchronized::Synchronized | ( | ) |
Synchronized::~Synchronized | ( | ) |
bool Synchronized::lock | ( | ) |
Enter a critical section.
If this thread owned this lock already, the call succeeds too (returns TRUE), but there will not be recursive locking. Unlocking will always free the lock.
void Synchronized::notify | ( | ) |
Wakes up a single thread that is waiting on this object's monitor.
void Synchronized::notify_all | ( | ) |
Wakes up all threads that are waiting on this object's monitor.
TryLockResult Synchronized::trylock | ( | ) |
Try to enter a critical section.
If this thread owned this lock already, the call succeeds too (returns TRUE), but there will not be recursive locking. Unlocking will always free the lock.
bool Synchronized::unlock | ( | ) |
Leave a critical section.
If this thread called lock or trylock more than once successfully, this call will nevertheless release the lock (non-recursive locking).
void Synchronized::wait | ( | ) |
Causes current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.
bool Synchronized::wait | ( | unsigned long | timeout | ) |
Causes current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed.
timeout | timeout in milliseconds. |
return | TRUE if timeout occured, FALSE otherwise. |