This class implements a portable semaphore type for thread synchronization. It forwards all requests to an appropriate platform‐specific implementation.

Synopsis

Declared in <bslmt_semaphore.h>

class Semaphore;

Member Functions

Name

Description

Semaphore [constructor]

Constructors

~Semaphore [destructor]

Destroy this semaphore.

getValue

Return the value of the current count of this semaphore.

post

post overloads

tryWait

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

Block until the count of this semaphore is a positive value, then atomically decrement the count and return.

Created with MrDocs