Go to the documentation of this file.
67 virtual const char*
what()
const throw() {
return "Thread::CondError";}
75 #ifndef DOXYGEN_PARSING
76 struct CondSetClockError:
public std::exception {
77 virtual const char* what()
const throw() {
return "Thread::CondSetClockError";}
82 virtual const char*
what()
const throw() {
return "Thread::MutexError";}
86 virtual const char*
what()
const throw() {
return "Thread::RecMutexError";}
118 pthread_mutex_t pthr_mutex;
147 int lock() {
return pthread_mutex_lock(&pthr_mutex);}
157 int trylock() {
return pthread_mutex_trylock(&pthr_mutex);}
170 int unlock() {
return pthread_mutex_unlock(&pthr_mutex);}
187 ~Mutex() {pthread_mutex_destroy(&pthr_mutex);}
189 #ifdef CGU_USE_GLIB_MEMORY_SLICES_NO_COMPAT
363 int lock() {
int ret = mutex.
lock();
if (!owner) owner = !ret;
return ret;}
391 int unlock() {
int ret = mutex.
unlock();
if (owner) owner = ret;
return ret;}
472 int signal() {
return pthread_cond_signal(&cond);}
508 int wait(
Mutex& mutex) {
return pthread_cond_wait(&cond, &mutex.pthr_mutex);}
559 return pthread_cond_timedwait(&cond, &mutex.pthr_mutex, &abs_time);
569 const timespec& abs_time) {
return timed_wait(lock.mutex, abs_time);}
578 const timespec& abs_time) {
return timed_wait(lock.mutex, abs_time);}
595 static void get_abs_time(timespec& ts,
unsigned int millisec);
633 ~Cond(
void) {pthread_cond_destroy(&cond);}
673 pthread_mutex_t pthr_mutex;
703 int lock() {
return pthread_mutex_lock(&pthr_mutex);}
720 int trylock() {
return pthread_mutex_trylock(&pthr_mutex);}
735 int unlock() {
return pthread_mutex_unlock(&pthr_mutex);}
983 int lock() {
int ret = mutex.
lock();
if (!owner) owner = !ret;
return ret;}
1022 int unlock() {
int ret = mutex.
unlock();
if (owner) owner = ret;
return ret;}
1083 #ifdef CGU_USE_DIAGNOSTIC_PRAGMAS
1084 #pragma GCC diagnostic push
1085 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1104 GStaticRecMutex& mutex;
1122 GStaticRecMutex*
get()
const {
return &mutex;}
1163 #ifdef CGU_USE_DIAGNOSTIC_PRAGMAS
1164 #pragma GCC diagnostic pop
static void get_abs_time(timespec &ts, unsigned int millisec)
int timed_wait(Mutex &mutex, const timespec &abs_time)
Definition: mutex.h:558
int unlock()
Definition: mutex.h:391
int unlock()
Definition: mutex.h:886
Definition: application.h:44
~TrackLock()
Definition: mutex.h:1075
int wait(Mutex::Lock &lock)
Definition: mutex.h:515
int trylock()
Definition: mutex.h:376
@ locked
Definition: mutex.h:196
Lock(Mutex &mutex_, Locked tag)
Definition: mutex.h:293
static bool have_monotonic_clock()
A wrapper class for pthread mutexes which provides a recursive mutex.
Definition: mutex.h:672
int broadcast()
Definition: mutex.h:483
A scoped locking class for exception safe RecMutex locking.
Definition: mutex.h:802
int lock()
Definition: mutex.h:363
int wait(Mutex::TrackLock &lock)
Definition: mutex.h:522
int trylock()
Definition: mutex.h:720
~Lock()
Definition: mutex.h:305
static int test_support()
virtual const char * what() const
Definition: mutex.h:67
RecMutex::Lock & operator=(const RecMutex::Lock &)=delete
int timed_wait(Mutex::TrackLock &lock, const timespec &abs_time)
Definition: mutex.h:577
A wrapper class for pthread condition variables.
Definition: mutex.h:449
int lock()
Definition: mutex.h:703
int trylock()
Definition: mutex.h:255
int timed_wait(Mutex::Lock &lock, const timespec &abs_time)
Definition: mutex.h:568
int signal()
Definition: mutex.h:472
TrackLock(Mutex &mutex_, DeferLock tag)
Definition: mutex.h:424
~TrackLock()
Definition: mutex.h:436
RecMutex & operator=(const RecMutex &)=delete
~Mutex()
Definition: mutex.h:187
~Cond(void)
Definition: mutex.h:633
GrecmutexLock(GStaticRecMutex &mutex_, Locked tag)
Definition: mutex.h:1141
Lock(RecMutex &mutex_)
Definition: mutex.h:899
A scoped locking class for exception safe Mutex locking which tracks the status of its mutex.
Definition: mutex.h:331
GrecmutexLock & operator=(const GrecmutexLock &)=delete
int wait(Mutex &mutex)
Definition: mutex.h:508
int trylock()
Definition: mutex.h:1005
int unlock()
Definition: mutex.h:1022
int lock()
Definition: mutex.h:836
A scoped locking class for exception safe RecMutex locking which tracks the status of its mutex.
Definition: mutex.h:949
TrackLock(RecMutex &mutex_, Locked tag)
Definition: mutex.h:1052
int unlock()
Definition: mutex.h:277
int trylock()
Definition: mutex.h:859
int lock()
Definition: mutex.h:983
Cond & operator=(const Cond &)=delete
@ defer
Definition: mutex.h:199
TrackLock(Mutex &mutex_, Locked tag)
Definition: mutex.h:415
int unlock()
Definition: mutex.h:735
bool is_owner() const
Definition: mutex.h:399
DeferLock
Definition: mutex.h:199
bool is_owner() const
Definition: mutex.h:1030
Lock(RecMutex &mutex_, Locked tag)
Definition: mutex.h:908
TrackLock(RecMutex &mutex_, DeferLock tag)
Definition: mutex.h:1061
int lock()
Definition: mutex.h:147
A scoped locking class for exception safe Mutex locking.
Definition: mutex.h:207
Mutex::Lock & operator=(const Mutex::Lock &)=delete
GStaticRecMutex * get() const
Definition: mutex.h:1122
TrackLock(Mutex &mutex_)
Definition: mutex.h:406
#define CGU_GLIB_MEMORY_SLICES_FUNCS
Definition: cgu_config.h:84
A scoped locking class for exception safe locking of GStaticRecMutex objects.
Definition: mutex.h:1103
Locked
Definition: mutex.h:196
virtual const char * what() const
Definition: mutex.h:86
RecMutex::TrackLock & operator=(const RecMutex::TrackLock &)=delete
virtual const char * what() const
Definition: mutex.h:82
Mutex & operator=(const Mutex &)=delete
~RecMutex()
Definition: mutex.h:789
int unlock()
Definition: mutex.h:170
int trylock()
Definition: mutex.h:157
Lock(Mutex &mutex_)
Definition: mutex.h:284
Mutex()
Definition: mutex.h:179
A wrapper class for pthread mutexes.
Definition: mutex.h:117
~Lock()
Definition: mutex.h:921
int lock()
Definition: mutex.h:240
Mutex::TrackLock & operator=(const Mutex::TrackLock &)=delete
TrackLock(RecMutex &mutex_)
Definition: mutex.h:1043