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() noexcept {
return pthread_mutex_lock(&pthr_mutex);}
157 int trylock() noexcept {
return pthread_mutex_trylock(&pthr_mutex);}
170 int unlock() noexcept {
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() noexcept {
int ret = mutex.
lock();
if (!owner) owner = !ret;
return ret;}
376 int trylock() noexcept {
int ret = mutex.
trylock();
if (!owner) owner = !ret;
return ret;}
391 int unlock() noexcept {
int ret = mutex.
unlock();
if (owner) owner = ret;
return ret;}
472 int signal() noexcept {
return pthread_cond_signal(&cond);}
483 int broadcast() noexcept {
return pthread_cond_broadcast(&cond);}
508 int wait(
Mutex& mutex) noexcept {
return pthread_cond_wait(&cond, &mutex.pthr_mutex);}
559 return pthread_cond_timedwait(&cond, &mutex.pthr_mutex, &abs_time);
569 const timespec& abs_time) noexcept {
return timed_wait(lock.mutex, abs_time);}
578 const timespec& abs_time) noexcept {
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() noexcept {
return pthread_mutex_lock(&pthr_mutex);}
720 int trylock() noexcept {
return pthread_mutex_trylock(&pthr_mutex);}
735 int unlock() noexcept {
return pthread_mutex_unlock(&pthr_mutex);}
983 int lock() noexcept {
int ret = mutex.
lock();
if (!owner) owner = !ret;
return ret;}
1005 int trylock() noexcept {
int ret = mutex.
trylock();
if (!owner) owner = !ret;
return ret;}
1022 int unlock() noexcept {
int ret = mutex.
unlock();
if (owner) owner = ret;
return ret;}
1098 GStaticRecMutex& mutex;
1116 GStaticRecMutex*
get()
const noexcept {
return &mutex;}
int lock() noexcept
Definition: mutex.h:147
int trylock() noexcept
Definition: mutex.h:376
RecMutex::Lock & operator=(const RecMutex::Lock &)=delete
virtual const char * what() const
Definition: mutex.h:82
int trylock() noexcept
Definition: mutex.h:859
Mutex & operator=(const Mutex &)=delete
Lock(Mutex &mutex_) noexcept
Definition: mutex.h:284
int timed_wait(Mutex::Lock &lock, const timespec &abs_time) noexcept
Definition: mutex.h:568
virtual const char * what() const
Definition: mutex.h:86
A scoped locking class for exception safe RecMutex locking which tracks the status of its mutex...
Definition: mutex.h:949
static int test_support()
int unlock() noexcept
Definition: mutex.h:170
int wait(Mutex::TrackLock &lock) noexcept
Definition: mutex.h:522
int trylock() noexcept
Definition: mutex.h:255
TrackLock(RecMutex &mutex_, DeferLock tag) noexcept
Definition: mutex.h:1061
A wrapper class for pthread condition variables.
Definition: mutex.h:449
int unlock() noexcept
Definition: mutex.h:277
int lock() noexcept
Definition: mutex.h:836
int trylock() noexcept
Definition: mutex.h:1005
Lock(Mutex &mutex_, Locked tag) noexcept
Definition: mutex.h:293
int timed_wait(Mutex &mutex, const timespec &abs_time) noexcept
Definition: mutex.h:558
~Lock()
Definition: mutex.h:305
~TrackLock()
Definition: mutex.h:1075
A scoped locking class for exception safe RecMutex locking.
Definition: mutex.h:802
TrackLock(Mutex &mutex_, DeferLock tag) noexcept
Definition: mutex.h:424
static void get_abs_time(timespec &ts, unsigned int millisec)
static bool have_monotonic_clock()
TrackLock(Mutex &mutex_) noexcept
Definition: mutex.h:406
int lock() noexcept
Definition: mutex.h:983
RecMutex::TrackLock & operator=(const RecMutex::TrackLock &)=delete
A scoped locking class for exception safe Mutex locking.
Definition: mutex.h:207
Mutex::Lock & operator=(const Mutex::Lock &)=delete
~TrackLock()
Definition: mutex.h:436
Lock(RecMutex &mutex_)
Definition: mutex.h:899
int trylock() noexcept
Definition: mutex.h:157
A wrapper class for pthread mutexes.
Definition: mutex.h:117
TrackLock(RecMutex &mutex_)
Definition: mutex.h:1043
GrecmutexLock & operator=(const GrecmutexLock &)=delete
bool is_owner() const noexcept
Definition: mutex.h:1030
int timed_wait(Mutex::TrackLock &lock, const timespec &abs_time) noexcept
Definition: mutex.h:577
Mutex()
Definition: mutex.h:179
Definition: application.h:44
TrackLock(Mutex &mutex_, Locked tag) noexcept
Definition: mutex.h:415
int unlock() noexcept
Definition: mutex.h:886
A scoped locking class for exception safe Mutex locking which tracks the status of its mutex...
Definition: mutex.h:331
bool is_owner() const noexcept
Definition: mutex.h:399
int trylock() noexcept
Definition: mutex.h:720
Locked
Definition: mutex.h:196
DeferLock
Definition: mutex.h:199
int unlock() noexcept
Definition: mutex.h:1022
A scoped locking class for exception safe locking of GStaticRecMutex objects.
Definition: mutex.h:1097
int signal() noexcept
Definition: mutex.h:472
int broadcast() noexcept
Definition: mutex.h:483
~Cond(void)
Definition: mutex.h:633
RecMutex & operator=(const RecMutex &)=delete
int wait(Mutex &mutex) noexcept
Definition: mutex.h:508
A wrapper class for pthread mutexes which provides a recursive mutex.
Definition: mutex.h:672
int wait(Mutex::Lock &lock) noexcept
Definition: mutex.h:515
~RecMutex()
Definition: mutex.h:789
Mutex::TrackLock & operator=(const Mutex::TrackLock &)=delete
virtual const char * what() const
Definition: mutex.h:67
TrackLock(RecMutex &mutex_, Locked tag) noexcept
Definition: mutex.h:1052
Lock(RecMutex &mutex_, Locked tag) noexcept
Definition: mutex.h:908
int lock() noexcept
Definition: mutex.h:240
int unlock() noexcept
Definition: mutex.h:735
int unlock() noexcept
Definition: mutex.h:391
int lock() noexcept
Definition: mutex.h:703
#define CGU_GLIB_MEMORY_SLICES_FUNCS
Definition: cgu_config.h:84
Cond & operator=(const Cond &)=delete
~Mutex()
Definition: mutex.h:187
int lock() noexcept
Definition: mutex.h:363
GrecmutexLock(GStaticRecMutex &mutex_, Locked tag)
Definition: mutex.h:1135
~Lock()
Definition: mutex.h:921