Browse Source

JackClient: Lock before killing client notification thread

The client notification thread locks a mutex before reading/writing
from/to the socket. If the thread is killed while the lock is taken it
would leave the mutex dangling.

To avoid this take the mutex and then kill the client notification thread.


Signed-off-by: Laxmi Devi <Laxmi.Devi@in.bosch.com>
pull/889/head
Laxmi Devi 2 years ago
parent
commit
e933e28dca
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      common/JackClient.cpp

+ 5
- 2
common/JackClient.cpp View File

@@ -107,14 +107,17 @@ int JackClient::Close()
int result = 0;

Deactivate();

assert(JackGlobals::fSynchroMutex);
// Channels is stopped first to avoid receiving notifications while closing
fChannel->Stop();
JackGlobals::fSynchroMutex->Lock();
fChannel->Stop();
JackGlobals::fSynchroMutex->Unlock();
// Then close client
fChannel->ClientClose(GetClientControl()->fRefNum, &result);
fChannel->Close();
assert(JackGlobals::fSynchroMutex);
JackGlobals::fSynchroMutex->Lock();
fSynchroTable[GetClientControl()->fRefNum].Disconnect();
JackGlobals::fSynchroMutex->Unlock();


Loading…
Cancel
Save