Fix: pthread::mutex unlock must not throw
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 14 Jun 2022 16:11:54 +0000 (12:11 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 15 Jun 2022 15:08:02 +0000 (11:08 -0400)
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 <jeremie.galarneau@efficios.com>
Change-Id: I5dfd856f8a2dd29fd7c480c6ab6289b5b91c4391

src/common/pthread-lock.hpp

index 35fde097cadbf92ea6f6744bc236272c2120c5e7..d19e3f3fbeb9ba066c19494ce209191859d2b495 100644 (file)
@@ -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();
                }
        }
 
This page took 0.02489 seconds and 4 git commands to generate.