ASL
|
A semaphore allows synchronizing access to shared resources and signaling observers when they can use the resource.
An observer calls wait()
to wait for the producer to provide something. At that time the producer calls post()
on the same semaphore to signal that.
#include <Mutex.h>
Public Member Functions | |
void | post (int n=1) |
Wake up a waiting thread and increase the semaphore count by n. | |
void | wait () |
Wait for the semaphore to signal. | |
bool | wait (double timeout) |
Wait for the semaphore to signal up to a timeout (s) and return true if it has signaled. | |