[#BloombergLP-bslmt-Latch] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::Latch :relfileprefix: ../../ :mrdocs: Provide a single‐use thread synchronization mechanism on an event count. == Synopsis Declared in `<bslmt_latch.h>` [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. == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/Latch/_04enum.adoc[`Unnamed enum`] | Status codes for timed wait operations. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/Latch/2constructor-00.adoc[`Latch`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bslmt/Latch/2destructor.adoc[`~Latch`] [.small]#[destructor]# | Destroy this latch. The behavior is undefined if any threads are waiting on this latch. | xref:BloombergLP/bslmt/Latch/arrive.adoc[`arrive`] | Decrement the event count by 1 and release waiters if it reaches 0. | xref:BloombergLP/bslmt/Latch/arriveAndWait.adoc[`arriveAndWait`] | Decrement the event count by 1, then wait until the latch is released. | xref:BloombergLP/bslmt/Latch/clockType.adoc[`clockType`] | Return the clock type used for timeouts. | xref:BloombergLP/bslmt/Latch/countDown.adoc[`countDown`] | Decrement the event count by `numEvents` and release waiters if 0. | xref:BloombergLP/bslmt/Latch/currentCount.adoc[`currentCount`] | Return the current number of events for which this latch is waiting. | xref:BloombergLP/bslmt/Latch/timedWait-07.adoc[`timedWait`] | Block until this latch is released or `absTime` expires. | xref:BloombergLP/bslmt/Latch/tryWait.adoc[`tryWait`] | Return whether this latch has already been released. | xref:BloombergLP/bslmt/Latch/wait.adoc[`wait`] | Block until the number of events this latch waits for reaches 0. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#