From b86644799c0fb10be2568ed1647b7a5d43441a40 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 3 Aug 2005 18:42:12 +0000 Subject: [PATCH] Fix for server thread hang if no data available on getblock --- transceiver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/transceiver.c b/transceiver.c index 46a2f23..4ff34ab 100644 --- a/transceiver.c +++ b/transceiver.c @@ -1,6 +1,8 @@ /* Edited for VOMP by Chris Tallon Edits Copyright 2004-2005 Chris Tallon + + This class will be replaced soon. */ /* @@ -223,9 +225,16 @@ unsigned long cMediamvpTransceiver::getBlock(unsigned char* buffer, unsigned lon { pthread_mutex_lock(&ringLock); + int numTries = 0; + while ((unsigned long)rb.getContent() < amount) { pthread_mutex_unlock(&ringLock); + if (++numTries == 10) // 5s + { + log->log("Transciever", Log::DEBUG, "getBlock timeout"); + return 0; + } usleep(500000); pthread_mutex_lock(&ringLock); } -- 2.39.2