BloombergLP::bslmt::FastPostSemaphore::tryWait

Attempt to decrement this semaphore's count without blocking.

Synopsis

Declared in <bslmt_fastpostsemaphore.h>

int
tryWait();

Description

If this semaphore is initially disabled, return e_DISABLED with no effect on the count. Otherwise, if the count of this semaphore is a positive value, return 0 and atomically decrement the count. If this semaphore is not disabled and the count of this semaphore is not a positive value, return e_WOULD_BLOCK with no effect on the count.

Return Value

0 on success, e_DISABLED if disabled, or e_WOULD_BLOCK