try to avoid output pthread_t as-is, due to MSVC etc.

This commit is contained in:
Paul Davis 2023-04-23 11:26:00 -06:00
parent c16ee928de
commit 35b5861195
4 changed files with 9 additions and 6 deletions

View File

@ -554,6 +554,7 @@ Parser::realtime_msg(unsigned char inbyte)
switch (inbyte) {
case 0xf8:
std::cerr << "tick\n";
timing (*this, _timestamp);
break;
case 0xf9:

View File

@ -115,10 +115,10 @@ EventLoop::get_request_buffers_for_target_thread (const std::string& target_thre
vector<ThreadBufferMapping> 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;
}

View File

@ -115,7 +115,7 @@ AbstractUI<RequestObject>::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<RequestObject>::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<RequestObject>::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));

View File

@ -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 (); }