1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Now using a separate mutex to fix the race between SVDRP CHAN and cDevice::HasProgramme()

This commit is contained in:
Klaus Schmidinger 2017-05-30 11:06:55 +02:00
parent 6edfcda43a
commit f97a59597f
4 changed files with 10 additions and 4 deletions

View File

@ -2858,6 +2858,8 @@ Derek Kelly <user.vdr@gmail.com>
for suggesting to change the naming of "binary skip mode" to "adaptive skip mode"
for suggesting to make the -u option also accept a numerical user id
for reporting a problem with abs() in gcc6+ when called with an unsigned variable
for reporting a deadlock after the fix for a race between SVDRP CHAN and
cDevice::HasProgramme()
Marcel Unbehaun <frostworks@gmx.de>
for adding cRecordingInfo::GetEvent()

View File

@ -9084,3 +9084,6 @@ Video Disk Recorder Revision History
- Fixed generating k_Release key events for LIRC remote controls (due to the short
timeout another normal key was sometimes put into the queue after the generated
release). Also removed some code redundancy and added some buffer checks.
- Now using a separate mutex to fix the race between SVDRP CHAN and
cDevice::HasProgramme(), because the previous fix caused a deadlock (reported by
Derek Kelly).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: device.c 4.22 2017/05/18 09:27:55 kls Exp $
* $Id: device.c 4.23 2017/05/30 11:06:11 kls Exp $
*/
#include "device.h"
@ -834,7 +834,7 @@ bool cDevice::SwitchChannel(int Direction)
eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
{
cMutexLock MutexLock(&mutexReceiver); // to avoid a race between SVDRP CHAN and HasProgramme()
cMutexLock MutexLock(&mutexChannel); // to avoid a race between SVDRP CHAN and HasProgramme()
cStatus::MsgChannelSwitch(this, 0, LiveView);
if (LiveView) {
@ -947,7 +947,7 @@ bool cDevice::HasLock(int TimeoutMs) const
bool cDevice::HasProgramme(void) const
{
cMutexLock MutexLock(&mutexReceiver); // to avoid a race between SVDRP CHAN and HasProgramme()
cMutexLock MutexLock(&mutexChannel); // to avoid a race between SVDRP CHAN and HasProgramme()
return Replaying() || pidHandles[ptAudio].pid || pidHandles[ptVideo].pid;
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: device.h 4.9 2017/05/09 11:24:47 kls Exp $
* $Id: device.h 4.10 2017/05/30 11:06:11 kls Exp $
*/
#ifndef __DEVICE_H
@ -257,6 +257,7 @@ public:
// Channel facilities
private:
mutable cMutex mutexChannel;
time_t occupiedTimeout;
protected:
static int currentChannel;