diff --git a/libs/midi++2/parser.cc b/libs/midi++2/parser.cc index da75aec248..8ac24c09a9 100644 --- a/libs/midi++2/parser.cc +++ b/libs/midi++2/parser.cc @@ -554,6 +554,7 @@ Parser::realtime_msg(unsigned char inbyte) switch (inbyte) { case 0xf8: + std::cerr << "tick\n"; timing (*this, _timestamp); break; case 0xf9: diff --git a/libs/pbd/event_loop.cc b/libs/pbd/event_loop.cc index f8ee665203..a13748d1a0 100644 --- a/libs/pbd/event_loop.cc +++ b/libs/pbd/event_loop.cc @@ -115,10 +115,10 @@ EventLoop::get_request_buffers_for_target_thread (const std::string& target_thre vector ret; Glib::Threads::Mutex::Lock lm (thread_buffer_requests_lock); - DEBUG_TRACE (PBD::DEBUG::EventLoop, string_compose ("%1 look for request buffers via %2\n", pthread_name(), target_thread)); + DEBUG_TRACE (PBD::DEBUG::EventLoop, string_compose ("%1 look for request buffers via %2\n", pthread_name(), DEBUG_THREAD_PRINT (target_thread))); for (auto const & tbr : thread_buffer_requests) { - DEBUG_TRACE (PBD::DEBUG::EventLoop, string_compose ("for thread \"%1\", request buffer for %2 (%3) thread %4\n", target_thread, tbr.emitting_thread, tbr.num_requests)); + DEBUG_TRACE (PBD::DEBUG::EventLoop, string_compose ("for thread \"%1\", request buffer for %2 (%3) thread %4\n", target_thread, DEBUG_THREAD_PRINT(tbr.emitting_thread), tbr.num_requests)); ret.push_back (tbr); } @@ -191,7 +191,7 @@ EventLoop::remove_request_buffer_from_map (pthread_t pth) Glib::Threads::Mutex::Lock lm (thread_buffer_requests_lock); for (ThreadRequestBufferList::iterator x = thread_buffer_requests.begin(); x != thread_buffer_requests.end(); ++x) { - if (x->emitting_thread == pth) { + if (pthread_equal (x->emitting_thread, pth)) { thread_buffer_requests.erase (x); break; } diff --git a/libs/pbd/pbd/abstract_ui.cc b/libs/pbd/pbd/abstract_ui.cc index d0750d7fa0..7d1901d999 100644 --- a/libs/pbd/pbd/abstract_ui.cc +++ b/libs/pbd/pbd/abstract_ui.cc @@ -115,7 +115,7 @@ AbstractUI::register_thread (pthread_t thread_id, string thread_n return; } - DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("in %1 (thread name %2), [%3] (%4) wants to register with us (%1)\n", event_loop_name(), pthread_name(), thread_name, thread_id)); + DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("in %1 (thread name %2), [%3] (%4) wants to register with us (%1)\n", event_loop_name(), pthread_name(), thread_name, DEBUG_THREAD_PRINT(thread_id))); /* the per_thread_request_buffer is a thread-private variable. See pthreads documentation for more on these, but the key @@ -135,7 +135,7 @@ AbstractUI::register_thread (pthread_t thread_id, string thread_n if (ib == request_buffers.end()) { /* create a new request queue/ringbuffer */ - DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("create new request buffer for %1 in %2 from %3/%4\n", thread_name, event_loop_name(), pthread_name(), thread_id)); + DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("create new request buffer for %1 in %2 from %3/%4\n", thread_name, event_loop_name(), pthread_name(), DEBUG_THREAD_PRINT(thread_id))); b = new RequestBuffer (num_requests); // XXX leaks store = true; } @@ -152,7 +152,7 @@ AbstractUI::register_thread (pthread_t thread_id, string thread_n Glib::Threads::RWLock::WriterLock rbml (request_buffer_map_lock); request_buffers[thread_id] = b; - DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2/%3 registered request buffer-B @ %4 for %5\n", event_loop_name(), pthread_name(), DEBUG_THREAD_SELF, b, thread_id)); + DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2/%3 registered request buffer-B @ %4 for %5\n", event_loop_name(), pthread_name(), DEBUG_THREAD_SELF, b, DEBUG_THREAD_PRINT(thread_id))); } else { DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1 : %2 is already registered\n", event_loop_name(), thread_name)); diff --git a/libs/pbd/pbd/debug.h b/libs/pbd/pbd/debug.h index aed65c1e1f..bda8bd7c7e 100644 --- a/libs/pbd/pbd/debug.h +++ b/libs/pbd/pbd/debug.h @@ -84,8 +84,10 @@ namespace PBD { #define DEBUG_ENABLED(bits) (((bits) & PBD::debug_bits).any()) #ifdef PTW32_VERSION #define DEBUG_THREAD_SELF pthread_self().p +#define DEBUG_THREAD_PRINT(t) t.p #else #define DEBUG_THREAD_SELF pthread_self() +#define DEBUG_THREAD_PRINT(t) t #endif #define DEBUG_TIMING_START(bits,td) if (DEBUG_ENABLED (bits)) { td.start_timing (); }