Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::completion_latch Class Reference

#include <completion_latch.hpp>

Public Types

typedef csbl::function< void()> completion_function
 the implementation defined completion function type More...
 

Public Member Functions

 completion_latch (std::size_t count)
 Constructs a latch with a given count. More...
 
template<typename F >
 completion_latch (std::size_t count, BOOST_THREAD_RV_REF(F) funct)
 Constructs a latch with a given count and a completion function. More...
 
template<typename F >
 completion_latch (std::size_t count, void(*funct)())
 
 ~completion_latch ()
 
void wait ()
 Blocks until the latch has counted down to zero. More...
 
bool try_wait ()
 
template<class Rep , class Period >
cv_status wait_for (const chrono::duration< Rep, Period > &rel_time)
 try to wait for a specified amount of time More...
 
template<class Clock , class Duration >
cv_status wait_until (const chrono::time_point< Clock, Duration > &abs_time)
 try to wait until the specified time_point is reached More...
 
void count_down ()
 Decrement the count and notify anyone waiting if we reach zero. More...
 
void signal ()
 
void count_down_and_wait ()
 Decrement the count and notify anyone waiting if we reach zero. More...
 
void sync ()
 
void reset (std::size_t count)
 Reset the counter #Requires This method may only be invoked when there are no other threads currently inside the count_down_and_wait() method. More...
 
completion_function then (void(*funct)())
 Resets the latch with the new completion function. More...
 

Static Public Member Functions

static completion_function noop ()
 noop completion function factory More...
 

Friends

struct around_wait
 

Member Typedef Documentation

typedef csbl::function<void()> boost::completion_latch::completion_function

the implementation defined completion function type

Constructor & Destructor Documentation

boost::completion_latch::completion_latch ( std::size_t  count)
inline

Constructs a latch with a given count.

template<typename F >
boost::completion_latch::completion_latch ( std::size_t  count,
BOOST_THREAD_RV_REF(F)  funct 
)
inline

Constructs a latch with a given count and a completion function.

template<typename F >
boost::completion_latch::completion_latch ( std::size_t  count,
void(*)()  funct 
)
inline
boost::completion_latch::~completion_latch ( )
inline

Member Function Documentation

void boost::completion_latch::count_down ( )
inline

Decrement the count and notify anyone waiting if we reach zero.

count must be greater than 0

Referenced by count_down_and_wait(), and signal().

void boost::completion_latch::count_down_and_wait ( )
inline

Decrement the count and notify anyone waiting if we reach zero.

Blocks until the latch has counted down to zero. count must be greater than 0

References around_wait, and count_down().

Referenced by sync().

static completion_function boost::completion_latch::noop ( )
inlinestatic

noop completion function factory

References boost::thread_detail::noop().

void boost::completion_latch::reset ( std::size_t  count)
inline

Reset the counter #Requires This method may only be invoked when there are no other threads currently inside the count_down_and_wait() method.

References count.

void boost::completion_latch::signal ( )
inline

References count_down().

void boost::completion_latch::sync ( )
inline

References count_down_and_wait().

completion_function boost::completion_latch::then ( void(*)()  funct)
inline

Resets the latch with the new completion function.

The next time the internal count reaches 0, this function will be invoked. This completion function may only be invoked when there are no other threads currently inside the count_down and wait related functions. It may also be invoked from within the registered completion function. the old completion function if any or noop if

bool boost::completion_latch::try_wait ( void  )
inline
Returns
true if the internal counter is already 0, false otherwise

References around_wait.

void boost::completion_latch::wait ( void  )
inline

Blocks until the latch has counted down to zero.

References around_wait.

template<class Rep , class Period >
cv_status boost::completion_latch::wait_for ( const chrono::duration< Rep, Period > &  rel_time)
inline

try to wait for a specified amount of time

Returns
whether there is a timeout or not.

References around_wait.

template<class Clock , class Duration >
cv_status boost::completion_latch::wait_until ( const chrono::time_point< Clock, Duration > &  abs_time)
inline

try to wait until the specified time_point is reached

Returns
whether there is a timeout or not.

References around_wait.

Friends And Related Function Documentation

friend struct around_wait
friend

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