Mailing List archive

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

[vdr] Re: WaitForPut/WaitForGet (was VDR developer version 1.1.31)



On 12 May 2003 Klaus Schmidinger <Klaus.Schmidinger@cadsoft.de> wrote:
> Stefan Huelswitt wrote:
>> 
>> With these functions removed, how I'm supposed to wait in a
>> non-busy way for data arrival or free buffer space?
>> 
>> I cannot understand why these have been removed (specialy if we
>> are close to a release). This makes the ringbuffer pretty useless
>> for most uses and breaks not only my plugins.
> 
> There was a problem with cReceivers that used cRingBuffer* to buffer
> the data they got in their Receive() function. The Receive() function
> is supposed to return _immediately_, but when the ring buffer was full
> it waited _inside_ the Put() function for up to a full second - which
> broke the data stream for all cReceivers attached to that device.
> 
> Therefore I tested what would happen if the WaitForPut/WaitForGet mechanism was
> removed and didn't see any difference in recording, replaying or transfer mode.
> I wasn't aware that any plugin would explicitly call any of these functions.

Ok, now I understand this change.

> So, if any plugin is using such a buffer in a cReceiver it would risk breaking
> the data stream if the buffer runs full. And if it uses the buffer in a different
> context I wonder why the waiting should be done in the buffer and not where
> the actual reading or writing is done. Maybe take a look at how VDR does this
> in cDvbPlayer::Action().

I think this isn't a good example. If the ringbuffer is
empty, the code does a busy wait loop, smoothed only by the
DevicePoll() timeout of 100.

Actualy the code should WAIT on the data, but this is difficult
here as you have to wait on a fd too.

If I have a loop which reads data from the ringbuffer only, I
must have a possibility to wait for data. With the current design
I can only use busy usleep() loop or build some conditional var
around the calls myself.

> Of course I could put these things back into cRingBuffer, but VDR itself
> wouldn't be using them any more, and any plugin that implements a cReceiver
> also shouldn't do so. If there are other applications that _really_ need
> WaitForPut/WaitForGet please let me know.

I understand that you cannot keep the WaitForPut/Get inside
Put/Get, but it would be nice to keep the wait functions and the
EnableGet/Put calls inside Get/Put so one could use them
optionaly.

Regards.

-- 
Stefan Huelswitt
huels@iname.com  | http://home.pages.de/~nathan


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index