From ba0b04ba129622da1b6fb04558fbced98546aa1c Mon Sep 17 00:00:00 2001 From: Winfried Koehler <78253700+wirbel-at-vdr-portal@users.noreply.github.com> Date: Tue, 2 Mar 2021 20:50:43 +0100 Subject: [PATCH] HasLock(): add timeout feature (#71) --- device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/device.c b/device.c index 9a5a5b3..53fe909 100644 --- a/device.c +++ b/device.c @@ -448,6 +448,14 @@ void cSatipDevice::CloseDvr(void) bool cSatipDevice::HasLock(int timeoutMsP) const { debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, timeoutMsP, deviceIndexM); + if (timeoutMsP > 0) { + cTimeMs timer(timeoutMsP); + while (!timer.TimedOut()) { + if (pTunerM && pTunerM->HasLock()) + return true; + cCondWait::SleepMs(100); + } + } return (pTunerM && pTunerM->HasLock()); }