Class semaphore¶
Defined in File semaphore.hpp
Class Documentation¶
-
class
concore::v1::semaphore¶ The classic “semaphore” synchronization primitive.
It atomically maintains an internal count. The count can always be increased by calling signal(), which is always a non-blocking call. When calling wait(), the count is decremented; if the count is still positive the call will be non-blocking; if the count goes below zero, the call to wait() will block until some other thread calls signal().
Public Functions
-
semaphore(int start_count = 0)¶ Constructs a new semaphore instance.
- Parameters
start_count: The value that the semaphore count should have at start
-
~semaphore()¶ Destructor.
-
void
wait()¶ Decrement the internal count and wait on the count to be positive.
If the count of the semaphore is positive this will decrement the count and return immediately. On the other hand, if the count is 0, it wait for it to become positive before decrementing it and returning.
- See
-