17 pthread_mutexattr_t lAttr;
19 int s = pthread_mutexattr_init(&lAttr);
22 log(lExc,
"Error code ",
Integer(s),
" (", strerror(s),
") returned in mutex attr initialisation");
26 s = pthread_mutexattr_setpshared(&lAttr, PTHREAD_PROCESS_SHARED);
29 log(lExc,
"Error code ",
Integer(s),
" (", strerror(s),
") returned by pthread_mutexattr_setpshared");
33 s = pthread_mutexattr_setrobust(&lAttr, PTHREAD_MUTEX_ROBUST);
36 log(lExc,
"Error code ",
Integer(s),
" (", strerror(s),
") returned by pthread_mutexattr_setrobust");
40 s = pthread_mutex_init(&
mMutex, &lAttr);
43 log(lExc,
"Error code ",
Integer(s),
" (", strerror(s),
") returned in mutex initialisation");
56 int s = pthread_mutex_lock(&
mMutex);
57 bool lLastOwnerDied = (s == EOWNERDEAD);
59 s = pthread_mutex_consistent(&
mMutex);
63 log(lExc,
"Error code ",
Integer(s),
" (", strerror(s),
") returned when ", lLastOwnerDied ?
"making mutex state consistent" :
"locking mutex");
71 int s = pthread_mutex_unlock(&
mMutex);
73 log(
Error(),
"Error code ",
Integer(s),
" (", strerror(s),
") returned when unlocking mutex");
uint64_t getCounter() const
_Integer< T, IntFmt<> > Integer(const T &aT)
Forward declare a function which creates an instance of the ultra-lightweight wrapper from an integer...
void log(FatalLevel &aFatal, const T0 &aArg0)
Function to add a log entry at Fatal level.