Mailing List archive

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

[vdr] Re: lock handling in sections.c



Jouni Karvo wrote:
hello,

I found this code in sections.c (1.3.16):

bool DeviceHasLock = device->HasLock();
if (!DeviceHasLock)
cCondWait::SleepMs(100);

I wonder why lock is not checked again after the sleep...

I have had some problems with the budget after an EPG scan, and my
preliminary tests look like the attached patch might actually help.
The patch is against 1.3.14 or 16, the files are the same in both of
them.

yours,
Jouni

--- ../vdr-1.3.14/sections.c 2004-10-24 14:05:12.000000000 +0300
+++ sections.c 2004-12-22 13:32:26.000000000 +0200
@@ -184,9 +184,12 @@
Unlock();
if (poll(pfd, NumFilters, 1000) > 0) {
- bool DeviceHasLock = device->HasLock();
- if (!DeviceHasLock)
- cCondWait::SleepMs(100);
+ int round=0; // jouninlisays
+ bool DeviceHasLock;
+ while (((DeviceHasLock = device->HasLock())==false) && + (round++ < 20)) {
+ cCondWait::SleepMs(100);
+ }
for (int i = 0; i < NumFilters; i++) {
if (pfd[i].revents & POLLIN) {
cFilterHandle *fh = NULL;
I wonder why this would change anything.

If the device has no lock, no filters will have been set.
Any data that comes in through the file handles will just be
discarded a little further down:

                     if (!DeviceHasLock)
                        continue; // we do the read anyway, to flush any data that might have come from a different transponder

Besides, after the last cCondWait::SleepMs(100) your code still doesn't
re-check device->HasLock().

Are you really sure that this change actually helped?

Klaus




Home | Main Index | Thread Index