[#BloombergLP-bslmt-FastPostSemaphoreImpl]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::FastPostSemaphoreImpl
:relfileprefix: ../../
:mrdocs:

This class implements a semaphore type, optimized for `post`, for thread synchronization&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ATOMIC&lowbar;OP,
    class MUTEX,
    class CONDITION,
    class THREADUTIL&gt;
class FastPostSemaphoreImpl;
----

== Enums

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/ReturnValue.adoc[`ReturnValue`] 
| Status codes returned by semaphore operations&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/2constructor-09.adoc[`FastPostSemaphoreImpl`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/clockType.adoc[`clockType`] 
| Return the clock type used for timeouts&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/disable.adoc[`disable`] 
| Disable waiting on this semaphore&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/enable.adoc[`enable`] 
| Enable waiting on this semaphore&period; If the semaphore is initially enabled, this call has no effect&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/getDisabledState.adoc[`getDisabledState`] 
| Return an odd value if this semaphore is wait disabled, and an even value otherwise&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/getValue.adoc[`getValue`] 
| Return the current value (`count &gt; 0 ? count &colon; 0`) of this semaphore&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/getValueRaw.adoc[`getValueRaw`] 
| Return the current value (`count`) of this semaphore&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/isDisabled.adoc[`isDisabled`] 
| Return `true` if this semaphore is wait disabled, and `false` otherwise&period; Note that the semaphore is created in the &quot;wait enabled&quot; state&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/post-03.adoc[`post`] 
| `post` overloads
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/postWithRedundantSignal.adoc[`postWithRedundantSignal`] 
| Atomically increase the count of this semaphore by the specified `value`&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/take.adoc[`take`] 
| Reduce the count by up to `maximumToTake` and return the amount taken&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/takeAll.adoc[`takeAll`] 
| If the count of this semaphore is positive, reduce the count to 0 and return the original value of the count&period; Otherwise, do nothing and return 0&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/timedWait.adoc[`timedWait`] 
| Block until a resource is available or `absTime` expires, then acquire it&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/tryWait.adoc[`tryWait`] 
| Attempt to acquire a resource without blocking&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/wait.adoc[`wait`] 
| Block until a resource is available and acquire it&period;
|===


== Static Data Members

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/k_AVAILABLE_INC.adoc[`k&lowbar;AVAILABLE&lowbar;INC`] 
| Increment value for the available count in `d&lowbar;state`&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/k_AVAILABLE_MASK.adoc[`k&lowbar;AVAILABLE&lowbar;MASK`] 
| Mask for the available&hyphen;count field in `d&lowbar;state`&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/k_AVAILABLE_SHIFT.adoc[`k&lowbar;AVAILABLE&lowbar;SHIFT`] 
| Bit shift for the available&hyphen;count field in `d&lowbar;state`&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/k_BLOCKED_INC.adoc[`k&lowbar;BLOCKED&lowbar;INC`] 
| Increment value for the blocked&hyphen;thread count in `d&lowbar;state`&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/k_BLOCKED_MASK.adoc[`k&lowbar;BLOCKED&lowbar;MASK`] 
| Mask for the blocked&hyphen;thread count field in `d&lowbar;state`&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/k_DISABLED_GEN_INC.adoc[`k&lowbar;DISABLED&lowbar;GEN&lowbar;INC`] 
| Increment value for the disabled&hyphen;generation count in `d&lowbar;state`&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/k_DISABLED_GEN_MASK.adoc[`k&lowbar;DISABLED&lowbar;GEN&lowbar;MASK`] 
| Mask for the disabled&hyphen;generation field in `d&lowbar;state`&period;
| xref:BloombergLP/bslmt/FastPostSemaphoreImpl/k_DISABLED_GEN_SHIFT.adoc[`k&lowbar;DISABLED&lowbar;GEN&lowbar;SHIFT`] 
| Bit shift for the disabled&hyphen;generation field in `d&lowbar;state`&period;
|===



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