add DEBUG_THREAD_SELF to allow use of DEBUG_TRACE with thread IDs on both normal pthreads platforms and PTW32
This commit is contained in:
parent
2bbef1f32e
commit
c06c15596b
@ -137,7 +137,7 @@ Butler::terminate_thread ()
|
|||||||
{
|
{
|
||||||
if (have_thread) {
|
if (have_thread) {
|
||||||
void* status;
|
void* status;
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: ask butler to quit @ %2\n", pthread_self(), g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: ask butler to quit @ %2\n", DEBUG_THREAD_SELF, g_get_monotonic_time()));
|
||||||
queue_request (Request::Quit);
|
queue_request (Request::Quit);
|
||||||
pthread_join (thread, &status);
|
pthread_join (thread, &status);
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ Butler::wait_for_requests ()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: butler awake at @ %2\n", pthread_self(), g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: butler awake at @ %2\n", DEBUG_THREAD_SELF, g_get_monotonic_time()));
|
||||||
|
|
||||||
if (pfd[0].revents & ~POLLIN) {
|
if (pfd[0].revents & ~POLLIN) {
|
||||||
error << string_compose (_("Error on butler thread request pipe: fd=%1 err=%2"), pfd[0].fd, pfd[0].revents) << endmsg;
|
error << string_compose (_("Error on butler thread request pipe: fd=%1 err=%2"), pfd[0].fd, pfd[0].revents) << endmsg;
|
||||||
@ -223,10 +223,10 @@ Butler::thread_work ()
|
|||||||
RouteList::iterator i;
|
RouteList::iterator i;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 butler main loop, disk work outstanding ? %2 @ %3\n", pthread_self(), disk_work_outstanding, g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 butler main loop, disk work outstanding ? %2 @ %3\n", DEBUG_THREAD_SELF, disk_work_outstanding, g_get_monotonic_time()));
|
||||||
|
|
||||||
if(!disk_work_outstanding) {
|
if(!disk_work_outstanding) {
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 butler waits for requests @ %2\n", pthread_self(), g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 butler waits for requests @ %2\n", DEBUG_THREAD_SELF, g_get_monotonic_time()));
|
||||||
if (wait_for_requests ()) {
|
if (wait_for_requests ()) {
|
||||||
Request::Type req;
|
Request::Type req;
|
||||||
|
|
||||||
@ -239,17 +239,17 @@ Butler::thread_work ()
|
|||||||
switch (req) {
|
switch (req) {
|
||||||
|
|
||||||
case Request::Run:
|
case Request::Run:
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: butler asked to run @ %2\n", pthread_self(), g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: butler asked to run @ %2\n", DEBUG_THREAD_SELF, g_get_monotonic_time()));
|
||||||
should_run = true;
|
should_run = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Request::Pause:
|
case Request::Pause:
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: butler asked to pause @ %2\n", pthread_self(), g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: butler asked to pause @ %2\n", DEBUG_THREAD_SELF, g_get_monotonic_time()));
|
||||||
should_run = false;
|
should_run = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Request::Quit:
|
case Request::Quit:
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: butler asked to quit @ %2\n", pthread_self(), g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: butler asked to quit @ %2\n", DEBUG_THREAD_SELF, g_get_monotonic_time()));
|
||||||
return 0;
|
return 0;
|
||||||
abort(); /*NOTREACHED*/
|
abort(); /*NOTREACHED*/
|
||||||
break;
|
break;
|
||||||
@ -404,7 +404,7 @@ Butler::thread_work ()
|
|||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: butler signals pause @ %2\n", pthread_self(), g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: butler signals pause @ %2\n", DEBUG_THREAD_SELF, g_get_monotonic_time()));
|
||||||
paused.signal();
|
paused.signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,7 +437,7 @@ Butler::queue_request (Request::Type r)
|
|||||||
void
|
void
|
||||||
Butler::summon ()
|
Butler::summon ()
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: summon butler to run @ %2\n", pthread_self(), g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: summon butler to run @ %2\n", DEBUG_THREAD_SELF, g_get_monotonic_time()));
|
||||||
queue_request (Request::Run);
|
queue_request (Request::Run);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ void
|
|||||||
Butler::stop ()
|
Butler::stop ()
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (request_lock);
|
Glib::Threads::Mutex::Lock lm (request_lock);
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: asking butler to stop @ %2\n", pthread_self(), g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: asking butler to stop @ %2\n", DEBUG_THREAD_SELF, g_get_monotonic_time()));
|
||||||
queue_request (Request::Pause);
|
queue_request (Request::Pause);
|
||||||
paused.wait(request_lock);
|
paused.wait(request_lock);
|
||||||
}
|
}
|
||||||
@ -454,7 +454,7 @@ void
|
|||||||
Butler::wait_until_finished ()
|
Butler::wait_until_finished ()
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (request_lock);
|
Glib::Threads::Mutex::Lock lm (request_lock);
|
||||||
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: waiting for butler to finish @ %2\n", pthread_self(), g_get_monotonic_time()));
|
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1: waiting for butler to finish @ %2\n", DEBUG_THREAD_SELF, g_get_monotonic_time()));
|
||||||
queue_request (Request::Pause);
|
queue_request (Request::Pause);
|
||||||
paused.wait(request_lock);
|
paused.wait(request_lock);
|
||||||
}
|
}
|
||||||
|
@ -55,12 +55,17 @@ namespace PBD {
|
|||||||
#define DEBUG_STR(id) __debug_str ## id
|
#define DEBUG_STR(id) __debug_str ## id
|
||||||
#define DEBUG_STR_APPEND(id,s) __debug_str ## id << s;
|
#define DEBUG_STR_APPEND(id,s) __debug_str ## id << s;
|
||||||
#define DEBUG_ENABLED(bits) ((bits) & PBD::debug_bits)
|
#define DEBUG_ENABLED(bits) ((bits) & PBD::debug_bits)
|
||||||
|
#define DEBUG_THREAD_SELF 0
|
||||||
#else
|
#else
|
||||||
#define DEBUG_TRACE(bits,fmt,...) /*empty*/
|
#define DEBUG_TRACE(bits,fmt,...) /*empty*/
|
||||||
#define DEBUG_STR(a) /* empty */
|
#define DEBUG_STR(a) /* empty */
|
||||||
#define DEBUG_STR_APPEND(a,b) /* empty */
|
#define DEBUG_STR_APPEND(a,b) /* empty */
|
||||||
#define DEBUG_ENABLED(b) (0)
|
#define DEBUG_ENABLED(b) (0)
|
||||||
|
#ifdef PTW32_VERSION
|
||||||
|
#define DEBUG_THREAD_SELF pthread_self().p
|
||||||
|
#else
|
||||||
|
#define DEBUG_THREAD_SELF pthread_self()
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __libpbd_debug_h__ */
|
#endif /* __libpbd_debug_h__ */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user