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


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



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