On Sam, 2008-02-23 at 15:54 +0100, Erik Tromp wrote:
[....]
> 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 if a packet arrives.

ACK.

> According to the man page of select(2):
> 
> "The select function may update the timeout parameter to indicate 
> how much time was left."
> 
> 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, is thus (at least) OS-dependent which implies that the code either
always ignores the returned timeout value or uses it if we know (e.g.
via an OS-dependent compile-time #define) that it is reliable.
poll(2) BTW is only "better" as it never returns the remaining timeout
so there is no possibility discussion there.

BTW the select(2) sys-call is dying out and now sometimes just a wrapper
(e.g. in the GNU-libc) function of poll(2). So I don't think that
investing time and complexity in a micro-optimization of a select(2)
call simply doesn't pay off.

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



