From 78d79d96b1cd6fabfea1a8a3260d2f0856ad3213 Mon Sep 17 00:00:00 2001 From: Stephane Letz Date: Sat, 6 Apr 2013 13:30:26 +0200 Subject: [PATCH] Correct FW and thread RT Drop/Acquire. --- common/JackClient.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/JackClient.cpp b/common/JackClient.cpp index 70e7f7aa..8a9835e9 100644 --- a/common/JackClient.cpp +++ b/common/JackClient.cpp @@ -232,7 +232,10 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, case kStartFreewheelCallback: jack_log("JackClient::kStartFreewheel"); SetupDriverSync(true); - fThread.DropRealTime(); // Always done (JACK server in RT mode or not...) + // Drop RT only when the RT thread is actually running + if (fThread.GetStatus() == JackThread::kRunning) { + fThread.DropRealTime(); + } if (fFreewheel) { fFreewheel(1, fFreewheelArg); } @@ -244,8 +247,9 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, if (fFreewheel) { fFreewheel(0, fFreewheelArg); } - if (GetEngineControl()->fRealTime) { - if (fThread.AcquireRealTime() < 0) { + // Acquire RT only when the RT thread is actually running + if (GetEngineControl()->fRealTime && fThread.GetStatus() == JackThread::kRunning) { + if (fThread.AcquireRealTime(GetEngineControl()->fClientPriority) < 0) { jack_error("JackClient::AcquireRealTime error"); } }