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

Provide a single&hyphen;use thread synchronization mechanism on an event count&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class Latch;
----

== Description

This class defines a thread synchronization mechanism that allows one or more threads to wait until a certain number of operations have been performed by other threads&period;

== Enums

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmt/Latch/_04enum.adoc[`Unnamed enum`] 
| Status codes for timed wait operations&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmt/Latch/2constructor-00.adoc[`Latch`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bslmt/Latch/2destructor.adoc[`&#126;Latch`] [.small]#[destructor]#
| Destroy this latch&period; The behavior is undefined if any threads are waiting on this latch&period;
| xref:BloombergLP/bslmt/Latch/arrive.adoc[`arrive`] 
| Decrement the event count by 1 and release waiters if it reaches 0&period;
| xref:BloombergLP/bslmt/Latch/arriveAndWait.adoc[`arriveAndWait`] 
| Decrement the event count by 1, then wait until the latch is released&period;
| xref:BloombergLP/bslmt/Latch/clockType.adoc[`clockType`] 
| Return the clock type used for timeouts&period;
| xref:BloombergLP/bslmt/Latch/countDown.adoc[`countDown`] 
| Decrement the event count by `numEvents` and release waiters if 0&period;
| xref:BloombergLP/bslmt/Latch/currentCount.adoc[`currentCount`] 
| Return the current number of events for which this latch is waiting&period;
| xref:BloombergLP/bslmt/Latch/timedWait-07.adoc[`timedWait`] 
| Block until this latch is released or `absTime` expires&period;
| xref:BloombergLP/bslmt/Latch/tryWait.adoc[`tryWait`] 
| Return whether this latch has already been released&period;
| xref:BloombergLP/bslmt/Latch/wait.adoc[`wait`] 
| Block until the number of events this latch waits for reaches 0&period;
|===



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