Re: [PATCH] Hang when moving between editing marks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

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;

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/


[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux