#include <bslmt_semaphore.h>
This class implements a portable semaphore type for thread synchronization. It forwards all requests to an appropriate platform-specific implementation.
See bslmt_semaphore
◆ Semaphore() [1/2]
bslmt::Semaphore::Semaphore |
( |
| ) |
|
|
inline |
Create a semaphore initially having a count of 0. This method does not return normally unless there are sufficient system resources to construct the object.
◆ Semaphore() [2/2]
bslmt::Semaphore::Semaphore |
( |
int |
count | ) |
|
|
inlineexplicit |
Create a semaphore initially having the specified count
. This method does not return normally unless there are sufficient system resources to construct the object.
◆ ~Semaphore()
bslmt::Semaphore::~Semaphore |
( |
| ) |
|
|
inline |
◆ getValue()
int bslmt::Semaphore::getValue |
( |
| ) |
const |
|
inline |
◆ post() [1/2]
void bslmt::Semaphore::post |
( |
| ) |
|
|
inline |
◆ post() [2/2]
void bslmt::Semaphore::post |
( |
int |
value | ) |
|
|
inline |
Atomically increase the count of this semaphore by the specified value
. The behavior is undefined unless value > 0
.
◆ tryWait()
int bslmt::Semaphore::tryWait |
( |
| ) |
|
|
inline |
If the count of this semaphore is positive, atomically decrement the count and return 0; otherwise, return a non-zero value with no effect on the count.
◆ wait()
void bslmt::Semaphore::wait |
( |
| ) |
|
|
inline |
Block until the count of this semaphore is a positive value, then atomically decrement the count and return.
The documentation for this class was generated from the following file: