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: wmglo at dent dot med dot uni-muenchen dot de
- Subject: Re: [comp.os.linux.development.system] Bug in glibc-2.1.1: sleep(0) sleeps 10ms
- From: Chiaki Ishikawa <Chiaki dot Ishikawa at personal-media dot co dot jp>
- Date: Fri, 15 Oct 1999 21:54:34 +0900 (JST)
- cc: libc-alpha at sourceware dot cygnus dot com, peer at knoll-is dot de
X-PMC-CI-e-mail-id: 11535
>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'.
I concur with the last statement.
I have used sleep(0) for exactly yiedling the time slice in not so
many programs.
Maybe I am guilty of using not clearly written functionality, but reading the
man pages of sleep made me think the use was a quite a valid one.
Oh come to think of it, the sleep(0) idiom was the only one
I could think of to yield time slice without doing much, i.e., like
calling system calls that does something meaningful. sleep(0) was a
system call without doing much and thus fitted my need.
--
Ishikawa, Chiaki ishikawa@personal-media.co.jp.NoSpam or
(family name, given name) Chiaki.Ishikawa@personal-media.co.jp.NoSpam
Personal Media Corp. ** Remove .NoSpam at the end before use **
Shinagawa, Tokyo, Japan 142-0051