From a41f112b079700d380b08645cd21bd61d80c971d Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Thu, 29 Jun 2023 21:26:07 -0400 Subject: [PATCH] libroot: Downgrade lock assertion into a syslog print. It seems there has been a bug lurking for years that this exposed. Rather than inconvenience users further, as it's not especially hard to trigger, let's down-grade it into a message until it can be properly investigated and fixed. Related to #18451. --- src/system/libroot/os/locks/mutex.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/system/libroot/os/locks/mutex.cpp b/src/system/libroot/os/locks/mutex.cpp index 4bcef54a72..07a8f44d1c 100644 --- a/src/system/libroot/os/locks/mutex.cpp +++ b/src/system/libroot/os/locks/mutex.cpp @@ -90,6 +90,12 @@ __mutex_unlock(mutex *lock) _kern_mutex_unblock(&lock->lock, 0); } - if ((oldValue & B_USER_MUTEX_LOCKED) == 0) + if ((oldValue & B_USER_MUTEX_LOCKED) == 0) { +#if 0 debugger("mutex was not actually locked!"); +#else + // The above happens too often at present (see bug #18451). + _kern_debug_output("libroot __mutex_unlock: mutex was not actually locked!\n"); +#endif + } }