[#BloombergLP-bslmt-TimedSemaphoreImpl-04b] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/TimedSemaphoreImpl-09.adoc[TimedSemaphoreImpl]<xref:BloombergLP/bslmt/Platform/PthreadTimedSemaphore.adoc[Platform::PthreadTimedSemaphore]> :relfileprefix: ../../ :mrdocs: This class implements a portable semaphore type for thread synchronization. == Synopsis Declared in `<bslmt_timedsemaphoreimpl_pthread.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> class xref:BloombergLP/bslmt/TimedSemaphoreImpl-09.adoc[TimedSemaphoreImpl]<xref:BloombergLP/bslmt/Platform/PthreadTimedSemaphore.adoc[Platform::PthreadTimedSemaphore]>; ---- == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/TimedSemaphoreImpl-04b/_04enum.adoc[`Unnamed enum`] | The value `timedWait` returns when a timeout occurs. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/TimedSemaphoreImpl-04b/2constructor-03a.adoc[`TimedSemaphoreImpl`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bslmt/TimedSemaphoreImpl-04b/2destructor.adoc[`~TimedSemaphoreImpl`] [.small]#[destructor]# | Destroy this semaphore object. | xref:BloombergLP/bslmt/TimedSemaphoreImpl-04b/clockType.adoc[`clockType`] | Return the clock type used for timeouts. | xref:BloombergLP/bslmt/TimedSemaphoreImpl-04b/post-0b.adoc[`post`] | `post` overloads | xref:BloombergLP/bslmt/TimedSemaphoreImpl-04b/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-04b/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-04b/wait.adoc[`wait`] | Block until the count is a positive value and atomically decrement it. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#