From patchwork Wed May 11 20:19:47 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ludwig Nussel X-Patchwork-Id: 11871 Received: from ns.suse.de ([195.135.220.2] helo=mx1.suse.de) by www.linuxtv.org with esmtp (Exim 4.34) id 1DVxgM-0006Kw-M3 for vdr@linuxtv.org; Wed, 11 May 2005 22:19:50 +0200 Received: from hermes.suse.de (hermes-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id C5238160FA11 for ; Wed, 11 May 2005 22:19:47 +0200 (CEST) Date: Wed, 11 May 2005 22:19:47 +0200 From: Ludwig Nussel To: vdr@linuxtv.org Subject: Re: [vdr] Re: [PATCH] Hang when moving between editing marks Message-ID: <20050511201947.GA25978@suse.de> Mail-Followup-To: vdr@linuxtv.org References: <4D516C3CF4%linux@youmustbejoking.demon.co.uk> <427D0B81.7080605@gmx.de> <427E1BBB.2090503@cadsoft.de> <200505081631.30994.sebastian@schnapsleichen.de> <427E2432.5020201@cadsoft.de> <427E26D2.4010601@cadsoft.de> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <427E26D2.4010601@cadsoft.de> X-Operating-System: SuSE Linux 9.3 (i586) X-Accept-Language: de en X-PGP-Fingerprint: 2987 6870 60BA 3158 F587 88C5 2394 431A FF81 35CE User-Agent: Mutt/1.5.9i X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2005 20:19:50 -0000 Status: O X-Status: X-Keywords: X-UID: 2124 Klaus Schmidinger wrote: > Here's another suggestion (line numbers may be a little off). > The only difference to Reinhard's patch is that the sleep is done > outside the locked area. Why not just get rid of that sleep completely? cu Ludwig Index: vdr-1.3.24/dvbplayer.c =================================================================== --- vdr-1.3.24.orig/dvbplayer.c +++ vdr-1.3.24/dvbplayer.c @@ -191,6 +191,7 @@ private: bool running; bool firstPacket; ePlayModes playMode; + cCondVar playMode_condition; ePlayDirs playDir; int trickSpeed; int readIndex, writeIndex; @@ -355,6 +356,7 @@ void cDvbPlayer::Activate(bool On) } else if (active) { running = false; + playMode_condition.Broadcast(); Cancel(3); active = false; } @@ -372,14 +374,9 @@ void cDvbPlayer::Action(void) nonBlockingFileReader = new cNonBlockingFileReader; int Length = 0; - bool Sleep = false; running = true; while (running && (NextFile() || readIndex >= 0 || ringBuffer->Available() || !DeviceFlush(100))) { - if (Sleep) { - cCondWait::SleepMs(3); // this keeps the CPU load low - Sleep = false; - } cPoller Poller; if (DevicePoll(Poller, 100)) { @@ -454,7 +451,7 @@ void cDvbPlayer::Action(void) } } else - Sleep = true; + playMode_condition.Wait(mutex); // Get the next frame from the buffer: @@ -528,6 +525,7 @@ void cDvbPlayer::Play(void) DevicePlay(); playMode = pmPlay; playDir = pdForward; + playMode_condition.Broadcast(); } } Index: vdr-1.3.24/thread.h =================================================================== --- vdr-1.3.24.orig/thread.h +++ vdr-1.3.24/thread.h @@ -77,11 +77,11 @@ class cThread { private: bool running; pthread_t childTid; - cMutex mutex; char *description; static bool emergencyExitRequested; static void *StartThread(cThread *Thread); protected: + cMutex mutex; void Lock(void) { mutex.Lock(); } void Unlock(void) { mutex.Unlock(); } virtual void Action(void) = 0;