use PBD::DEBUG::Threads as a toggle to show thread ID/name with debug output

This commit is contained in:
Paul Davis 2023-07-06 16:13:51 -06:00
parent a59c217205
commit 37f859197b

View file

@ -31,6 +31,7 @@
#include "pbd/debug.h" #include "pbd/debug.h"
#include "pbd/error.h" #include "pbd/error.h"
#include "pbd/pthread_utils.h"
#include "pbd/i18n.h" #include "pbd/i18n.h"
@ -102,6 +103,10 @@ PBD::new_debug_bit (const char* name)
void void
PBD::debug_only_print (const char* prefix, string str) PBD::debug_only_print (const char* prefix, string str)
{ {
if ((PBD::debug_bits & DEBUG::Threads).any()) {
printf ("0x%x (%s) ", (int) DEBUG_THREAD_SELF, pthread_name());
}
if ((PBD::debug_bits & DEBUG::DebugTimestamps).any()) { if ((PBD::debug_bits & DEBUG::DebugTimestamps).any()) {
printf ("%ld %s: %s", g_get_monotonic_time(), prefix, str.c_str()); printf ("%ld %s: %s", g_get_monotonic_time(), prefix, str.c_str());
} else { } else {