From: Jérémie Galarneau Date: Tue, 14 Jun 2022 16:11:54 +0000 (-0400) Subject: Fix: pthread::mutex unlock must not throw X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=460bede77c5a79691a3e1fca03c2d64209038f31;p=lttng-tools.git Fix: pthread::mutex unlock must not throw unlock() is often called by destructors (e.g. lock guard); it must not throw. We don't expect unlock to fail given our current usage anyhow. Signed-off-by: Jérémie Galarneau Change-Id: I5dfd856f8a2dd29fd7c480c6ab6289b5b91c4391 --- diff --git a/src/common/pthread-lock.hpp b/src/common/pthread-lock.hpp index 35fde097c..d19e3f3fb 100644 --- a/src/common/pthread-lock.hpp +++ b/src/common/pthread-lock.hpp @@ -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(); } }