cvs commit: src/lib/libc/sys select.2

Joerg Sonnenberger joerg at britannica.bec.de
Wed Aug 3 08:36:13 PDT 2005


On Wed, Aug 03, 2005 at 08:13:41AM -0700, Matthew Dillon wrote:
>:>Note that select behaves like sleep(3) when no descriptors are being checked.
> :
> :Please correct it to point to usleep or nanosleep, that comparision is
> :much more appropiate.
> :
> :Joerg
> 
>     Even nanosleep and usleep are wrong, since nanosleep uses a struct timespec
>     and select uses a struct timeval.
> 
>     Select's timeout is rounded up to the nearest clock tick, while (our) 
>     nanosleep's timeout tries to be a lot more precise.

They are not identical, but nanosleep has been emulated using select in
the past, that's why it is more appriopiate to point to it. sleep just
doesn't have any precision below seconds, so it's clearly no match.

The question of timespec vs. timeval isn't a big deal, we just don't
have pselect. I'm not sure if the rounding of select's timeout is
necessary, but it definitely is convient for the kernel.

Joerg





More information about the Commits mailing list