This class implements a semaphore type, optimized for post, for thread synchronization.

Synopsis

Declared in <bslmt_fastpostsemaphoreimpl.h>

template<
    class ATOMIC_OP,
    class MUTEX,
    class CONDITION,
    class THREADUTIL>
class FastPostSemaphoreImpl;

Enums

Name

Description

ReturnValue

Status codes returned by semaphore operations.

Member Functions

Name

Description

FastPostSemaphoreImpl [constructor]

Constructors

clockType

Return the clock type used for timeouts.

disable

Disable waiting on this semaphore.

enable

Enable waiting on this semaphore. If the semaphore is initially enabled, this call has no effect.

getDisabledState

Return an odd value if this semaphore is wait disabled, and an even value otherwise.

getValue

Return the current value (count > 0 ? count : 0) of this semaphore.

getValueRaw

Return the current value (count) of this semaphore.

isDisabled

Return true if this semaphore is wait disabled, and false otherwise. Note that the semaphore is created in the "wait enabled" state.

post

post overloads

postWithRedundantSignal

Atomically increase the count of this semaphore by the specified value.

take

Reduce the count by up to maximumToTake and return the amount taken.

takeAll

If the count of this semaphore is positive, reduce the count to 0 and return the original value of the count. Otherwise, do nothing and return 0.

timedWait

Block until a resource is available or absTime expires, then acquire it.

tryWait

Attempt to acquire a resource without blocking.

wait

Block until a resource is available and acquire it.

Static Data Members

Name

Description

k_AVAILABLE_INC

Increment value for the available count in d_state.

k_AVAILABLE_MASK

Mask for the available‐count field in d_state.

k_AVAILABLE_SHIFT

Bit shift for the available‐count field in d_state.

k_BLOCKED_INC

Increment value for the blocked‐thread count in d_state.

k_BLOCKED_MASK

Mask for the blocked‐thread count field in d_state.

k_DISABLED_GEN_INC

Increment value for the disabled‐generation count in d_state.

k_DISABLED_GEN_MASK

Mask for the disabled‐generation field in d_state.

k_DISABLED_GEN_SHIFT

Bit shift for the disabled‐generation field in d_state.

Created with MrDocs