This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [comp.os.linux.development.system] Bug in glibc-2.1.1: sleep(0) sleeps 10ms


> Should we add:
>  if (seconds == 0)
>     return 0;
> to sleep to optimize sleep (0) ?

I have no strong opinion, but I don't think so.

> AFAIK POSIX notes that "sleep may sleep for longer than the amount of
> time requested".

Exactly; SUS says

     The suspension
     time may be longer than requested due to the scheduling of other
     activity by the system.

I've seen a few programs using sleep(0) as a replacement for the
not-quite-so-well-known sched_yield() function, this would `break'.

Regards,
Wolfram.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]