From 4a289f48d9e550c3c319a5c54521b2ab205757a6 Mon Sep 17 00:00:00 2001 From: Stephane Letz Date: Tue, 20 Mar 2012 18:17:57 +0100 Subject: [PATCH] Correct JackMessageBuffer::SetInitCallback. --- common/JackMessageBuffer.cpp | 8 ++++---- tests/test.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/JackMessageBuffer.cpp b/common/JackMessageBuffer.cpp index 990d1288..f75b609c 100644 --- a/common/JackMessageBuffer.cpp +++ b/common/JackMessageBuffer.cpp @@ -111,7 +111,7 @@ bool JackMessageBuffer::Execute() /* and we're done */ fGuard.Signal(); } - + /* releasing the mutex reduces contention */ fGuard.Unlock(); Flush(); @@ -177,17 +177,17 @@ int JackMessageBuffer::SetInitCallback(JackThreadInitCallback callback, void *ar fGuard.Signal() // wait for it to be done fGuard.Wait(); + // and we're done + fGuard.Unlock(); */ + fGuard.Unlock(); int count = 0; while (fInit && ++count < 1000) { /* wake msg buffer thread */ fGuard.Signal(); JackSleep(1000); } - - /* and we're done */ - fGuard.Unlock(); if (count == 1000) goto error; return 0; } diff --git a/tests/test.cpp b/tests/test.cpp index 60ca7b08..438d3c1f 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -163,7 +163,7 @@ void Collect(FrameTimeCollector* TheFrame) void Jack_Thread_Init_Callback(void *arg) { - Log("Init callback has been successfully called. (msg from callback)\n"); + Log("Init callback has been successfully called from thread = %x. (msg from callback)\n", pthread_self()); init_clbk = 1; }