From: Chris Tallon Date: Thu, 7 Jun 2018 12:07:28 +0000 (+0100) Subject: Fix a threading deadlock causing a recording playback hang X-Git-Tag: 0-5-1~18 X-Git-Url: https://git.vomp.tv/gitweb/?a=commitdiff_plain;h=b9676b45242506e331c4d1f7712cffe485492d8f;p=vompclient.git Fix a threading deadlock causing a recording playback hang --- diff --git a/player.cc b/player.cc index 491650b..f796190 100644 --- a/player.cc +++ b/player.cc @@ -1182,6 +1182,7 @@ void Player::threadFeedPlay() { // demuxer is full and can't take anymore threadLock(); + if (!threadActive) { threadUnlock(); threadCheckExit(); } threadWaitForSignal(); threadUnlock(); } diff --git a/threadp.cc b/threadp.cc index a40a681..e57cfdd 100644 --- a/threadp.cc +++ b/threadp.cc @@ -45,7 +45,11 @@ int ThreadP::threadStart() void ThreadP::threadStop() { if (threadActive) { // we need this, on some implementations this will fail, if already stopped - threadActive = 0; + + threadLock(); + threadActive = 0; // New locking around this fixes a player lockup but could badly affect other things + threadUnlock(); + // Signal thread here in case it's waiting threadSignal(); pthread_join(pthread, NULL);