12 #include "gu_exception.hpp"
13 #include "gu_logger.hpp"
14 #include "gu_mutex.hpp"
15 #include "gu_cond.hpp"
16 #include "gu_datetime.hpp"
22 pthread_mutex_t*
const value;
29 Lock (
const Mutex& mtx) : value(&mtx.value)
32 int err = pthread_mutex_lock (value);
35 std::string msg =
"Mutex lock failed: ";
36 msg = msg + strerror(err);
43 int err = pthread_mutex_unlock (value);
46 log_fatal <<
"Mutex unlock failed: " << err <<
" ("
47 << strerror(err) <<
"), Aborting.";
53 inline void wait (
const Cond& cond)
56 pthread_cond_wait (&(cond.cond), value);
66 int ret = pthread_cond_timedwait (&(cond.cond), value, &ts);
69 if (gu_unlikely(ret)) gu_throw_error(ret);
Definition: gu_lock.hpp:20
Definition: gu_mutex.hpp:19
Definition: gu_cond.hpp:19
void _timespec(timespec &ts) const
Definition: gu_datetime.hpp:180
Definition: gu_exception.hpp:19
Date/time representation.
Definition: gu_datetime.hpp:115