[#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&period; It forwards all requests to an appropriate platform&hyphen;specific implementation&period;

== Synopsis

Declared in `&lt;bslmt&lowbar;semaphore&period;h&gt;`

[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[`&#126;Semaphore`] [.small]#[destructor]#
| Destroy this semaphore&period;
| xref:BloombergLP/bslmt/Semaphore/getValue.adoc[`getValue`] 
| Return the value of the current count of this semaphore&period;
| 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&semi; otherwise, return a non&hyphen;zero value with no effect on the count&period;
| 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&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
