
On Wed, 2008-07-30 at 15:31 +0200, Erik Tromp wrote:
[....]
> I remember being here before.... I cannot find the mail back in the archive,
> but, indeed it would be a nice new feature to replace the quite useless
> 'nanosleep' for a duration of 'Pollrate' seconds (default 50 msec) by a
> 'select' that waits for at most that time but returns earlier as soon as a
> packet arrives (that is: synchronously, not 'realtime' :-)

Yup.

> Just looking into the man page of select(2):
> 
> "The select function may update the timeout parameter to indicate how much
> time was left."

Yes, that's not portable.

> What worries me here is the word "may". It would be quite useful to know the
> time left. But that is a worry for the implementor.

Yes. The usual solution is to use gettimeofday() or similar afterwards.

But that's IMHO not needed here as one really wants to always calculate
the timeout *before* the select/poll to the end of the current polling
window (and God knows how long it takes from the first line after the
select/poll to the next select/poll call. I won't bet that it is
virtually always 0;-).

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services




