CARMA C++
|
A simple wrapper class that makes use of ::pthread_cond_t easier in a C++ world. More...
#include <carma/util/PthreadCond.h>
Public Member Functions | |
void | Broadcast () |
Wake any waiters. More... | |
const ::pthread_cond_t & | InternalPthreadCond () const |
Obtain a reference to the internal ::pthread_cond_t. More... | |
::pthread_cond_t & | InternalPthreadCond () |
Obtain a reference to the internal ::pthread_cond_t. More... | |
PthreadCond () | |
Default construct a cond with the CARMA defaults. More... | |
PthreadCond (const PthreadCondAttr &attr) | |
Construct a cond with the given attributes. More... | |
PthreadCond (const ::pthread_condattr_t &attr) | |
Construct a cond with the given attributes. More... | |
void | Signal () |
Wake one of any waiters. More... | |
bool | TimedWait (::pthread_mutex_t &m, const struct::timespec &abstime) |
Wait until waken or timed out. More... | |
bool | TimedWait (PthreadMutex &m, const struct::timespec &abstime) |
Wait until waken or timed out. More... | |
void | Wait (::pthread_mutex_t &m) |
Wait until waken. More... | |
void | Wait (PthreadMutex &m) |
Wait until waked. More... | |
A simple wrapper class that makes use of ::pthread_cond_t easier in a C++ world.
Condition variables (and ::pthread_cond_t, the POSIX realization of them) are a bit too complicated and tricky to explain here. Look them up in a book on POSIX/Pthread programming if you need more information.
Definition at line 43 of file PthreadCond.h.
|
explicit |
Default construct a cond with the CARMA defaults.
Any internal errors will throw an exception.
|
explicit |
Construct a cond with the given attributes.
Any internal errors will throw an exception.
|
explicit |
Construct a cond with the given attributes.
Any internal errors will throw an exception.
void carma::util::PthreadCond::Broadcast | ( | ) |
Wake any waiters.
Wake all threads waiting on this instance at the time of the call.
const ::pthread_cond_t & carma::util::PthreadCond::InternalPthreadCond | ( | ) | const |
Obtain a reference to the internal ::pthread_cond_t.
Definition at line 202 of file PthreadCond.h.
pthread_cond_t & carma::util::PthreadCond::InternalPthreadCond | ( | ) |
Obtain a reference to the internal ::pthread_cond_t.
Definition at line 209 of file PthreadCond.h.
void carma::util::PthreadCond::Signal | ( | ) |
Wake one of any waiters.
If any threads are waiting on this instance at the time of the call then wake one of them.
bool carma::util::PthreadCond::TimedWait | ( | ::pthread_mutex_t & | m, |
const struct::timespec & | abstime | ||
) |
Wait until waken or timed out.
Atomically release the given mutex and wait the caller's thread on this instance until either waked or abstime
has arrived in absolute time. In all cases the mutex will be reacquired (unless the given mutex is invalid/errors in some way). Spurious wakes may occur and hence the condition being waited for should be rechecked and rewaited if needed.
bool carma::util::PthreadCond::TimedWait | ( | PthreadMutex & | m, |
const struct::timespec & | abstime | ||
) |
Wait until waken or timed out.
Atomically release the given mutex and wait the caller's thread on this instance until either waked or abstime
has arrived in absolute time. In all cases the mutex will be reacquired (unless the given mutex is invalid/errors in some way). Spurious wakes may occur and hence the condition being waited for should be rechecked and rewaited if needed.
Definition at line 194 of file PthreadCond.h.
void carma::util::PthreadCond::Wait | ( | ::pthread_mutex_t & | m | ) |
Wait until waken.
Atomically release the given mutex and wait the caller's thread on this instance until waked and the mutex has been reacquired (unless the given mutex is invalid/errors in some way). Spurious wakes may occur and hence the condition being waited for should be rechecked and rewaited if needed.
void carma::util::PthreadCond::Wait | ( | PthreadMutex & | m | ) |
Wait until waked.
Atomically release the given mutex and wait the caller's thread on this instance until waked and the mutex has been reacquired (unless the given mutex is invalid/errors in some way). Spurious wakes may occur and hence the condition being waited for should be rechecked and rewaited if needed.
Definition at line 187 of file PthreadCond.h.