36#ifndef __PARA_PTH_COND_VAR_H__
37#define __PARA_PTH_COND_VAR_H__
86 int const error = pthread_cond_init(&
cond, 0);
102 pthread_cond_destroy(&
cond);
152 int const error = pthread_cond_wait(&
cond, &
lck->
mtx);
166 int const error = pthread_cond_signal(&
cond);
179 int const error = pthread_cond_broadcast(&
cond);
200#define CONDITIONVARIABLE_WAIT(var,cond) do { \
201 LockRAII raiiwait_((var)->getLock(), __FILE__, __LINE__); \
~ConditionVariable()
Destroy this condition variable. If the constructor allocated a new Lock for this condition variable ...
void lock(char const *file, int line)
Acquire the lock associated with this condition variable.
pthread_cond_t cond
The low-level condition variable.
void broadcast()
Signal on this condition variable. Broadcasting on a condition variable will wake up ALL threads that...
void signal()
Signal this condition variable. Signalling a condition variable will wake up ONE thread that is curre...
ConditionVariable(Lock *l=0)
Create a new condition variable. If l is NULL then the constructor will create a new Lock instance an...
Lock * lck
The lock associated with this instance.
void unlock()
Release the lock associated with this condition variable.
void wait()
Wait for this condition variable. The calling thread MUST hold the lock associated with this conditio...
void lock()
Acquire the lock associated with this condition variable.
void setLock(Lock *l)
set Lock from outside.
bool ownMutex
This is true iff the constructor did allocate lck.
ConditionVariable(ConditionVariable const &)
No copying or assignment of condition variables.
ConditionVariable & operator=(ConditionVariable const &)
Lock * getLock() const
Get the lock associated with this condition variable.
Class that implements a lock. The class wraps around pthread_mutex_t and adds some safeguards.
pthread_mutex_t mtx
The low-level mutex that implements this lock.
void unlock()
Release this lock.
void lock()
Acquire this lock. The function sets the internal file/line (debugging) fields to generic values.
Pthread lock for UG Framework.
Exception that is thrown whenever something goes wrong with a lock.