This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: [comp.os.linux.development.system] Bug in glibc-2.1.1: sleep(0) sleeps 10ms
- To: aj at suse dot de
- Subject: Re: [comp.os.linux.development.system] Bug in glibc-2.1.1: sleep(0) sleeps 10ms
- From: Wolfram Gloger <wmglo at dent dot med dot uni-muenchen dot de>
- Date: 15 Oct 1999 10:20:48 -0000
- CC: libc-alpha at sourceware dot cygnus dot com, peer at knoll-is dot de
- References: <holn95hoh9.fsf@zermelo.suse.de>
> 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.