diff --git a/ChangeLog b/ChangeLog index c2584615..2f5149a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,10 @@ Michael Voigt Jackdmp changes log --------------------------- +2008-11-19 Stephane Letz + + * Libjack shutdown handler does not "deactivate" (fActive = false) the client anymore, so that jack_deactivate correctly does the job later on. + 2008-11-14 Stephane Letz * Version 1.9.1 started, fix symbols export in ringbuffer.c, cleanup on Windows. diff --git a/common/JackClient.cpp b/common/JackClient.cpp index 983bab57..66999070 100644 --- a/common/JackClient.cpp +++ b/common/JackClient.cpp @@ -407,17 +407,17 @@ jack_nframes_t JackClient::Wait(int status) CallTimebaseCallback(); SignalSync(); if (status != 0) - return End(); + End(); // Terminates the thread if (!WaitSync()) - return Error(); + Error(); // Terminates the thread CallSyncCallback(); return GetEngineControl()->fBufferSize; } jack_nframes_t JackClient::CycleWait() { - if (!WaitSync()) - return Error(); + if (!WaitSync()) + Error(); // Terminates the thread CallSyncCallback(); return GetEngineControl()->fBufferSize; } @@ -427,8 +427,8 @@ void JackClient::CycleSignal(int status) if (status == 0) CallTimebaseCallback(); SignalSync(); - if (status != 0) - End(); + if (status != 0) + End(); // Terminates the thread } inline int JackClient::CallProcessCallback() @@ -455,7 +455,7 @@ inline void JackClient::SignalSync() } } -inline int JackClient::End() +inline void JackClient::End() { jack_log("JackClient::Execute end name = %s", GetClientControl()->fName); // Hum... not sure about this, the following "close" code is called in the RT thread... @@ -463,10 +463,10 @@ inline int JackClient::End() fThread.DropRealTime(); GetClientControl()->fActive = false; fChannel->ClientDeactivate(GetClientControl()->fRefNum, &result); - return 0; + fThread.Terminate(); } -inline int JackClient::Error() +inline void JackClient::Error() { jack_error("JackClient::Execute error name = %s", GetClientControl()->fName); // Hum... not sure about this, the following "close" code is called in the RT thread... @@ -475,7 +475,7 @@ inline int JackClient::Error() GetClientControl()->fActive = false; fChannel->ClientDeactivate(GetClientControl()->fRefNum, &result); ShutDown(); - return 0; + fThread.Terminate(); } //----------------- @@ -600,7 +600,6 @@ void JackClient::ShutDown() // Be sure client is already started if (GetClientControl()) { GetClientControl()->fServer = false; - GetClientControl()->fActive = false; } if (fShutdown) { diff --git a/common/JackClient.h b/common/JackClient.h index 3e053bf6..52a2c14b 100644 --- a/common/JackClient.h +++ b/common/JackClient.h @@ -104,8 +104,8 @@ class JackClient : public JackClientInterface, public JackRunnableInterface inline bool WaitSync(); inline void SignalSync(); inline int CallProcessCallback(); - inline int End(); - inline int Error(); + inline void End(); + inline void Error(); public: diff --git a/common/jack/types.h b/common/jack/types.h index e5a76181..3bf812ba 100644 --- a/common/jack/types.h +++ b/common/jack/types.h @@ -216,7 +216,12 @@ typedef void (*JackFreewheelCallback)(int starting, void *arg); /** * Prototype for the client supplied function that is called - * whenever jackd is shutdown. + * whenever jackd is shutdown. Note that after server shutdown, + * the client pointer is *not* deallocated by libjack, + * the application is responsible to properly use jack_client_close() + * to release client ressources. Warning: jack_client_close() cannot be + * safely used inside the shutdown callback and has to be called outside of + * the callback context. * * @param arg pointer to a client supplied structure */