Mailing List archive

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

[vdr] Re: vdr-1.3.17: thread issues with vdr-xine and vdr-osdteletext



C.Y.M wrote:
Klaus Schmidinger wrote:

...
OK, this has been a problem (even with the previous thread safe patches I was using), but when I try to use streamdev in suspend mode with Klaus' new threading patch, it appears that VDR is creating TWO threads.


Dec 19 12:33:07 poseidon vdr[26763]: switching to channel 10300
Dec 19 12:33:07 poseidon vdr[30554]: transfer thread started (pid=30554, tid=1900553)
Dec 19 12:33:07 poseidon vdr[30555]: transfer thread started (pid=30555, tid=1916938)
Dec 19 12:33:07 poseidon vdr[30556]: receiver on device 1 thread started (pid=30556, tid=1933323)
Dec 19 12:33:07 poseidon vdr[30557]: TS buffer on device 1 thread started (pid=30557, tid=1949708)
Dec 19 12:33:10 poseidon vdr[26779]: ERROR: thread 1933323 won't end (waited 3 seconds) - canceling it...
Dec 19 12:33:10 poseidon vdr[30555]: transfer thread ended (pid=30555, tid=1916938)
Dec 19 12:33:10 poseidon vdr[26779]: buffer stats: 0 (0%) used


That's odd. Does streamdev mess around with "Transfer Mode"?

I probably am not the right person to answer that question, but I know that if you manually tune vdr to a channel and then try to stream, it works fine. But, if I am on a different channel and use the suspend option to tell vdr to switch to the channel that I want it to stream, then there seems to be some kind of race condition that is causing two threads to be created. I wish I could offer you more details.

Thanks,
C.Y.M.
I know that there's still a possible race condition in cDevice::AttachReceiver().
You could try this (untested, just an idea):

--- device.c    2004/12/17 13:51:44     1.63
+++ device.c    2004/12/19 21:56:29
@@ -990,6 +990,7 @@
      esyslog("ERROR: device %d has no lock, can't attach receiver!", CardIndex() + 1);
      return false;
      }
+  LOCK_THREAD;
   for (int i = 0; i < MAXRECEIVERS; i++) {
       if (!receiver[i]) {
          for (int n = 0; n < MAXRECEIVEPIDS; n++) {
@@ -1000,10 +1001,8 @@
                 }
              }
          Receiver->Activate(true);
-         Lock();
          Receiver->device = this;
          receiver[i] = Receiver;
-         Unlock();
          Start();
          return true;
          }
@@ -1017,19 +1016,19 @@
   if (!Receiver || Receiver->device != this)
      return;
   bool receiversLeft = false;
+  Lock();
   for (int i = 0; i < MAXRECEIVERS; i++) {
       if (receiver[i] == Receiver) {
          Receiver->Activate(false);
-         Lock();
          receiver[i] = NULL;
          Receiver->device = NULL;
-         Unlock();
          for (int n = 0; n < MAXRECEIVEPIDS; n++)
              DelPid(Receiver->pids[n]);
          }
       else if (receiver[i])
          receiversLeft = true;
       }
+  Unlock();
   if (!receiversLeft) {
      active = false;
      Cancel(3);


The line numbers are probably way off, since I've already made several
other changes, but it should be fairly easy to make thes changes
manually.

Klaus




Home | Main Index | Thread Index