Lunchbox  1.9.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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

LUNCHBOX_API Condition ()
 Construct a new condition variable. More...
 
LUNCHBOX_API ~Condition ()
 Destruct this condition variable. More...
 
LUNCHBOX_API void lock ()
 Lock the mutex. More...
 
LUNCHBOX_API void unlock ()
 Unlock the mutex. More...
 
LUNCHBOX_API void signal ()
 Signal the condition. More...
 
LUNCHBOX_API void broadcast ()
 Broadcast the condition. More...
 
LUNCHBOX_API void wait ()
 Atomically unlock the mutex, wait for a signal and relock the mutex. More...
 
LUNCHBOX_API 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_API lunchbox::Condition::Condition ( )

Construct a new condition variable.

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

Destruct this condition variable.

Version
1.0

Member Function Documentation

LUNCHBOX_API void lunchbox::Condition::broadcast ( )
LUNCHBOX_API 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:

LUNCHBOX_API void lunchbox::Condition::signal ( )

Signal the condition.

Version
1.0
LUNCHBOX_API 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

Referenced by lunchbox::Monitor< T >::timedWaitEQ(), lunchbox::Monitor< T >::timedWaitGE(), and lunchbox::Monitor< T >::timedWaitNE().

+ Here is the caller graph for this function:

LUNCHBOX_API 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:

LUNCHBOX_API void lunchbox::Condition::wait ( )

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

Version
1.0

Referenced by lunchbox::Monitor< T >::waitEQ(), lunchbox::Monitor< T >::waitGE(), lunchbox::Monitor< T >::waitLE(), and lunchbox::Monitor< T >::waitNE().

+ Here is the caller graph for this function:


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