roo_threads
API Documentation for roo_threads
Loading...
Searching...
No Matches
roo::latch Class Reference

A synchronization aid that blocks until a counter reaches zero. More...

#include <latch.h>

Public Member Functions

 latch (std::ptrdiff_t count)
 Creates a latch with an initial counter value.
 
void count_down (std::ptrdiff_t n=1)
 Decrements the counter and wakes waiters when it reaches zero.
 
void wait () const
 Blocks until the internal counter reaches zero.
 

Detailed Description

A synchronization aid that blocks until a counter reaches zero.

Definition at line 9 of file latch.h.

Constructor & Destructor Documentation

◆ latch()

roo::latch::latch ( std::ptrdiff_t  count)
inlineexplicit

Creates a latch with an initial counter value.

Parameters
countinitial counter value.

Definition at line 13 of file latch.h.

Member Function Documentation

◆ count_down()

void roo::latch::count_down ( std::ptrdiff_t  n = 1)
inline

Decrements the counter and wakes waiters when it reaches zero.

Parameters
ndecrement amount.

Definition at line 17 of file latch.h.

◆ wait()

void roo::latch::wait ( ) const
inline

Blocks until the internal counter reaches zero.

Definition at line 25 of file latch.h.


The documentation for this class was generated from the following file: