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() 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);}
513 int wait(
Mutex& mutex) {
return pthread_cond_wait(&cond, &mutex.pthr_mutex);}
579 return pthread_cond_timedwait(&cond, &mutex.pthr_mutex, &abs_time);
594 const timespec& abs_time) {
return timed_wait(lock.mutex, abs_time);}
608 const timespec& abs_time) {
return timed_wait(lock.mutex, abs_time);}
663 ~Cond(
void) {pthread_cond_destroy(&cond);}
703 pthread_mutex_t pthr_mutex;
733 int lock() noexcept {
return pthread_mutex_lock(&pthr_mutex);}
750 int trylock() noexcept {
return pthread_mutex_trylock(&pthr_mutex);}
765 int unlock() noexcept {
return pthread_mutex_unlock(&pthr_mutex);}
1013 int lock() noexcept {
int ret = mutex.
lock();
if (!owner) owner = !ret;
return ret;}
1035 int trylock() noexcept {
int ret = mutex.
trylock();
if (!owner) owner = !ret;
return ret;}
1052 int unlock() noexcept {
int ret = mutex.
unlock();
if (owner) owner = ret;
return ret;}
1113 #ifdef CGU_USE_DIAGNOSTIC_PRAGMAS
1114 #pragma GCC diagnostic push
1115 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1134 GStaticRecMutex& mutex;
1152 GStaticRecMutex*
get() const noexcept {
return &mutex;}
1193 #ifdef CGU_USE_DIAGNOSTIC_PRAGMAS
1194 #pragma GCC diagnostic pop
int unlock() noexcept
Definition: mutex.h:1052
static void get_abs_time(timespec &ts, unsigned int millisec)
int lock() noexcept
Definition: mutex.h:363
int timed_wait(Mutex &mutex, const timespec &abs_time)
Definition: mutex.h:578
bool is_owner() const noexcept
Definition: mutex.h:1060
int lock() noexcept
Definition: mutex.h:1013
Definition: application.h:44
~TrackLock()
Definition: mutex.h:1105
int wait(Mutex::Lock &lock)
Definition: mutex.h:525
int trylock() noexcept
Definition: mutex.h:889
Cond(const Cond &)=delete
int lock() noexcept
Definition: mutex.h:147
@ locked
Definition: mutex.h:196
static bool have_monotonic_clock()
A wrapper class for pthread mutexes which provides a recursive mutex.
Definition: mutex.h:702
TrackLock(const RecMutex::TrackLock &)=delete
int unlock() noexcept
Definition: mutex.h:170
Lock(const Mutex::Lock &)=delete
A scoped locking class for exception safe RecMutex locking.
Definition: mutex.h:832
int wait(Mutex::TrackLock &lock)
Definition: mutex.h:537
TrackLock(const Mutex::TrackLock &)=delete
int broadcast() noexcept
Definition: mutex.h:483
~Lock()
Definition: mutex.h:305
static int test_support()
int trylock() noexcept
Definition: mutex.h:750
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:607
A wrapper class for pthread condition variables.
Definition: mutex.h:449
int lock() noexcept
Definition: mutex.h:733
int trylock() noexcept
Definition: mutex.h:376
TrackLock(Mutex &mutex_, DeferLock tag) noexcept
Definition: mutex.h:424
int timed_wait(Mutex::Lock &lock, const timespec &abs_time)
Definition: mutex.h:593
Lock(Mutex &mutex_) noexcept
Definition: mutex.h:284
~TrackLock()
Definition: mutex.h:436
int unlock() noexcept
Definition: mutex.h:916
RecMutex & operator=(const RecMutex &)=delete
~Mutex()
Definition: mutex.h:187
GrecmutexLock(const GrecmutexLock &)=delete
~Cond(void)
Definition: mutex.h:663
TrackLock(RecMutex &mutex_, Locked tag) noexcept
Definition: mutex.h:1082
GrecmutexLock(GStaticRecMutex &mutex_, Locked tag)
Definition: mutex.h:1171
Lock(RecMutex &mutex_)
Definition: mutex.h:929
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:513
GrecmutexLock(GStaticRecMutex &mutex_)
int lock() noexcept
Definition: mutex.h:240
int trylock() noexcept
Definition: mutex.h:157
Mutex(const Mutex &)=delete
A scoped locking class for exception safe RecMutex locking which tracks the status of its mutex.
Definition: mutex.h:979
TrackLock(Mutex &mutex_) noexcept
Definition: mutex.h:406
Cond & operator=(const Cond &)=delete
@ defer
Definition: mutex.h:199
GStaticRecMutex * get() const noexcept
Definition: mutex.h:1152
int signal() noexcept
Definition: mutex.h:472
DeferLock
Definition: mutex.h:199
A scoped locking class for exception safe Mutex locking.
Definition: mutex.h:207
TrackLock(Mutex &mutex_, Locked tag) noexcept
Definition: mutex.h:415
Mutex::Lock & operator=(const Mutex::Lock &)=delete
Lock(RecMutex &mutex_, Locked tag) noexcept
Definition: mutex.h:938
#define CGU_GLIB_MEMORY_SLICES_FUNCS
Definition: cgu_config.h:84
TrackLock(RecMutex &mutex_, DeferLock tag) noexcept
Definition: mutex.h:1091
int unlock() noexcept
Definition: mutex.h:277
A scoped locking class for exception safe locking of GStaticRecMutex objects.
Definition: mutex.h:1133
Locked
Definition: mutex.h:196
virtual const char * what() const
Definition: mutex.h:86
int trylock() noexcept
Definition: mutex.h:255
int trylock() noexcept
Definition: mutex.h:1035
RecMutex::TrackLock & operator=(const RecMutex::TrackLock &)=delete
Lock(const RecMutex::Lock &)=delete
virtual const char * what() const
Definition: mutex.h:82
int unlock() noexcept
Definition: mutex.h:391
Mutex & operator=(const Mutex &)=delete
~RecMutex()
Definition: mutex.h:819
int lock() noexcept
Definition: mutex.h:866
bool is_owner() const noexcept
Definition: mutex.h:399
RecMutex(const RecMutex &)=delete
int unlock() noexcept
Definition: mutex.h:765
Mutex()
Definition: mutex.h:179
A wrapper class for pthread mutexes.
Definition: mutex.h:117
Lock(Mutex &mutex_, Locked tag) noexcept
Definition: mutex.h:293
~Lock()
Definition: mutex.h:951
Mutex::TrackLock & operator=(const Mutex::TrackLock &)=delete
TrackLock(RecMutex &mutex_)
Definition: mutex.h:1073