[#BloombergLP-bslmt-Semaphore] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::Semaphore :relfileprefix: ../../ :mrdocs: This class implements a portable semaphore type for thread synchronization. It forwards all requests to an appropriate platform‐specific implementation. == Synopsis Declared in `<bslmt_semaphore.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class Semaphore; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/Semaphore/2constructor-05602.adoc[`Semaphore`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bslmt/Semaphore/2destructor.adoc[`~Semaphore`] [.small]#[destructor]# | Destroy this semaphore. | xref:BloombergLP/bslmt/Semaphore/getValue.adoc[`getValue`] | Return the value of the current count of this semaphore. | xref:BloombergLP/bslmt/Semaphore/post-0a.adoc[`post`] | `post` overloads | xref:BloombergLP/bslmt/Semaphore/tryWait.adoc[`tryWait`] | If the count of this semaphore is positive, atomically decrement the count and return 0; otherwise, return a non‐zero value with no effect on the count. | xref:BloombergLP/bslmt/Semaphore/wait.adoc[`wait`] | Block until the count of this semaphore is a positive value, then atomically decrement the count and return. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#