[#BloombergLP-bslmt-SemaphoreImpl-06] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/SemaphoreImpl-0a.adoc[SemaphoreImpl]<xref:BloombergLP/bslmt/Platform/PosixSemaphore.adoc[Platform::PosixSemaphore]> :relfileprefix: ../../ :mrdocs: This class provides a full specialization of `SemaphoreImpl` for pthreads. The implementation provided here defines an efficient proxy for the `sem_t` pthread type, and related operations. == Synopsis Declared in `<bslmt_semaphoreimpl_pthread.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> class xref:BloombergLP/bslmt/SemaphoreImpl-0a.adoc[SemaphoreImpl]<xref:BloombergLP/bslmt/Platform/PosixSemaphore.adoc[Platform::PosixSemaphore]>; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/SemaphoreImpl-06/2constructor.adoc[`SemaphoreImpl`] [.small]#[constructor]# | Create a semaphore initialized to the specified `count`. This method does not return normally unless there are sufficient system resources to construct the object. | xref:BloombergLP/bslmt/SemaphoreImpl-06/2destructor.adoc[`~SemaphoreImpl`] [.small]#[destructor]# | Destroy a semaphore | xref:BloombergLP/bslmt/SemaphoreImpl-06/getValue.adoc[`getValue`] | Return the current value of this semaphore. | xref:BloombergLP/bslmt/SemaphoreImpl-06/post-00.adoc[`post`] | `post` overloads | xref:BloombergLP/bslmt/SemaphoreImpl-06/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/SemaphoreImpl-06/wait.adoc[`wait`] | Block until the count of this semaphore is a positive value and atomically decrement it. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#