[#BloombergLP-bslmt-TimedSemaphoreImpl-041] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/TimedSemaphoreImpl-09.adoc[TimedSemaphoreImpl]<xref:BloombergLP/bslmt/Platform/PosixAdvTimedSemaphore.adoc[Platform::PosixAdvTimedSemaphore]> :relfileprefix: ../../ :mrdocs: This class implements a timed semaphore in terms of POSIX operations. Note that only certain platforms provide `sem_timedwait`; on those that do not, `TimedSemaphoreImpl<PthreadTimedSemaphore>` is used. == Synopsis Declared in `<bslmt_timedsemaphoreimpl_posixadv.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> class xref:BloombergLP/bslmt/TimedSemaphoreImpl-09.adoc[TimedSemaphoreImpl]<xref:BloombergLP/bslmt/Platform/PosixAdvTimedSemaphore.adoc[Platform::PosixAdvTimedSemaphore]>; ---- == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/TimedSemaphoreImpl-041/_04enum.adoc[`Unnamed enum`] | The value `timedWait` returns when a timeout occurs. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/TimedSemaphoreImpl-041/2constructor-06.adoc[`TimedSemaphoreImpl`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bslmt/TimedSemaphoreImpl-041/2destructor.adoc[`~TimedSemaphoreImpl`] [.small]#[destructor]# | Destroy this semaphore object. | xref:BloombergLP/bslmt/TimedSemaphoreImpl-041/clockType.adoc[`clockType`] | Return the clock type used for timeouts. | xref:BloombergLP/bslmt/TimedSemaphoreImpl-041/post-0d.adoc[`post`] | `post` overloads | xref:BloombergLP/bslmt/TimedSemaphoreImpl-041/timedWait.adoc[`timedWait`] | Block until the count of this semaphore is a positive value, or until the specified `absTime` timeout expires. `absTime` is an _absolute_ time represented as an interval from some epoch, which is determined by the clock indicated at construction (see {Supported Clock‐Types} in the component documentation). If the `absTime` timeout did not expire before the count attained a positive value, atomically decrement the count and return 0; otherwise, return a non‐zero value with no effect on the count. | xref:BloombergLP/bslmt/TimedSemaphoreImpl-041/tryWait.adoc[`tryWait`] | Decrement the count of this semaphore if it is positive and return 0. Return a non‐zero value otherwise. | xref:BloombergLP/bslmt/TimedSemaphoreImpl-041/wait.adoc[`wait`] | Block until the count is a positive value and atomically decrement it. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#