Lunchbox  1.13.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
lunchbox::Condition Class Reference

A condition variable and associated lock. More...

#include <condition.h>

+ Inheritance diagram for lunchbox::Condition:
+ Collaboration diagram for lunchbox::Condition:

Public Member Functions

 Condition ()
 Construct a new condition variable. More...
 
 ~Condition ()
 Destruct this condition variable. More...
 
void lock ()
 Lock the mutex. More...
 
void unlock ()
 Unlock the mutex. More...
 
void signal ()
 Signal the condition. More...
 
void broadcast ()
 Broadcast the condition. More...
 
void wait ()
 Atomically unlock the mutex, wait for a signal and relock the mutex. More...
 
bool timedWait (const uint32_t timeout)
 Atomically unlock the mutex, wait for a signal and relock the mutex. More...
 

Detailed Description

A condition variable and associated lock.

Semantics follow closely pthread_condition and mutex.

Definition at line 33 of file condition.h.

Constructor & Destructor Documentation

lunchbox::Condition::Condition ( )

Construct a new condition variable.

Version
1.0
lunchbox::Condition::~Condition ( )

Destruct this condition variable.

Version
1.0

Member Function Documentation

void lunchbox::Condition::broadcast ( )
void lunchbox::Condition::lock ( )

Lock the mutex.

Version
1.0

Referenced by lunchbox::MTQueue< T, S >::operator=().

+ Here is the caller graph for this function:

void lunchbox::Condition::signal ( )

Signal the condition.

Version
1.0
bool lunchbox::Condition::timedWait ( const uint32_t  timeout)

Atomically unlock the mutex, wait for a signal and relock the mutex.

The operation is aborted after the given timeout and false is returned.

Parameters
timeoutthe timeout in milliseconds to wait for the signal.
Returns
true on success, false on timeout.
Version
1.0
void lunchbox::Condition::unlock ( )

Unlock the mutex.

Version
1.0

Referenced by lunchbox::MTQueue< T, S >::operator=().

+ Here is the caller graph for this function:

void lunchbox::Condition::wait ( )

Atomically unlock the mutex, wait for a signal and relock the mutex.

Version
1.0

Referenced by lunchbox::Monitor< T >::waitNE().

+ Here is the caller graph for this function:


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