[vdr] possible busy loop in cDvbPlayer::Action?
M.Wache at gmx.net
Sat Jul 2 16:24:14 CEST 2005
Luca Olivetti schrieb:
> Martin Wache wrote:
>> I thought about letting the softdevice sleep even when the buffers are
>> not full, but I think the correct solution would be that vdr sleep in
>> case it doesn't have some frames to send. Or did I get the Poll()
>> function wrong? Should Poll() sleep in any case?
> from device.h
> virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
> ///< Returns true if the device itself or any of the file handles in
> ///< Poller is ready for further action.
> ///< If TimeoutMs is not zero, the device will wait up to the
> given number
> ///< of milleseconds before returning in case there is no immediate
> ///< need for data.
I know this header file, I read it many times, but it doesn't answer my
question. If you have a closer look at the methods of cDvbDevice and
cPoller, you will see that the method Poll() just calls the linux system
call poll() with the event POLLOUT. If you now have a look at the man
page of poll which states:
#define POLLOUT 0x0004 /* Writing now will not block */
wou will see that this is _exactly_ the way the softdevices Poll()
method is currently implemented. It will only sleep if a write to the
softdevice would block.
What would be needed from the softdevice to break the busy loop is that
the softdevice would have to sleep even though it _can_ accept data, but
I don't think that this makes sense, or do you?
To me it makes much more sense if the vdr would sleep if it doesn't have
any data to deliver.
So I'm interresteted what you think about this...
More information about the vdr