From aff1e44011a7888f00171a787ef14a62986dfbae Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Sun, 8 Jan 2023 17:44:35 +0100 Subject: [PATCH] _dbus_lock|unlock(): Dump pointer of DBusGlobalLock and mutex with TRACE_LOCKS defined --- dbus/dbus-threads.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dbus/dbus-threads.c b/dbus/dbus-threads.c index b22cc031..ccfd5871 100644 --- a/dbus/dbus-threads.c +++ b/dbus/dbus-threads.c @@ -31,6 +31,12 @@ /* Protected by _dbus_threads_lock_platform_specific() */ static int thread_init_generation = 0; +#ifdef DBUS_DISABLE_CHECKS +#undef TRACE_LOCKS +#else +#define TRACE_LOCKS +#endif + /** * @defgroup DBusThreadsInternals Thread functions * @ingroup DBusInternals @@ -347,6 +353,9 @@ _dbus_lock (DBusGlobalLock lock) !dbus_threads_init_default ()) return FALSE; +#ifdef TRACE_LOCKS + _dbus_verbose ("LOCK DBusGlobalLock:%d mutex:%p\n", lock, global_locks[lock]); +#endif _dbus_platform_rmutex_lock (global_locks[lock]); return TRUE; } @@ -357,6 +366,9 @@ _dbus_unlock (DBusGlobalLock lock) _dbus_assert (lock >= 0); _dbus_assert (lock < _DBUS_N_GLOBAL_LOCKS); +#ifdef TRACE_LOCKS + _dbus_verbose ("UNLOCK DBusGlobalLock:%d mutex:%p\n", lock, global_locks[lock]); +#endif _dbus_platform_rmutex_unlock (global_locks[lock]); }