From 460bede77c5a79691a3e1fca03c2d64209038f31 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 14 Jun 2022 12:11:54 -0400 Subject: [PATCH] Fix: pthread::mutex unlock must not throw MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/common/pthread-lock.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(); } } -- 2.34.1