X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fpthread-lock.hpp;h=824b2f2a91ce03cacedaab5bf6d72c3fb2f8660e;hb=cd9adb8b829564212158943a0d279bb35322ab30;hp=35fde097cadbf92ea6f6744bc236272c2120c5e7;hpb=0a325f4dec3f6d553dad5d2c26ebfdc78201c363;p=lttng-tools.git diff --git a/src/common/pthread-lock.hpp b/src/common/pthread-lock.hpp index 35fde097c..824b2f2a9 100644 --- a/src/common/pthread-lock.hpp +++ b/src/common/pthread-lock.hpp @@ -26,7 +26,7 @@ namespace details { */ class mutex { public: - mutex(pthread_mutex_t& mutex_p) : _mutex{mutex_p} + explicit mutex(pthread_mutex_t& mutex_p) : _mutex{mutex_p} { } @@ -57,7 +57,10 @@ public: void unlock() { if (pthread_mutex_unlock(&_mutex) != 0) { - LTTNG_THROW_POSIX("Failed to unlock mutex", errno); + /* + * Unlock cannot throw as it is called as part of lock_guard's destructor. + */ + abort(); } } @@ -73,7 +76,7 @@ private: */ class lock_guard { public: - lock_guard(pthread_mutex_t& mutex) : _mutex{mutex}, _guard(_mutex) + explicit lock_guard(pthread_mutex_t& mutex) : _mutex{mutex}, _guard(_mutex) { }