From: Tomas Pospisek's Mailing Lists Date: 2007-03-02T07:48:16+09:00 Subject: Re: replacing the use of gettimeofday in the scheduler On Fri, 2 Mar 2007, Eric Hodel wrote: > On Mar 1, 2007, at 13:30, Tomas Pospisek's Mailing Lists wrote: >> On Fri, 2 Mar 2007, Eric Hodel wrote: >>> The Ruby thread scheduler uses setitimer(2) and select(2). It depends on >>> the wall-clock for implementing features defined in terms of the >>> wall-clock (Kernel#sleep and Thread#join). >> >> You need to add Timeout#timeout to this. > > Nope. Timeout calls Kernel#sleep in a thread. Um. When I do a "timeout(5) { do_something };" and set the system clock back by a minute, then the timeout will not *ever* time out. >> But: >> >> $ ri Kernel#sleep >> >> Suspends the current thread for _duration_ seconds (which may be >> any number, including a +Float+ with fractional seconds). Returns >> the actual number of seconds slept (rounded), which may be less >> than that asked for if another thread calls +Thread#run+. Zero >> arguments causes +sleep+ to sleep forever. >> >> No reference to wall-clock in there. What do you mean by "defined in terms >> of the wall-clock"? > > When I write "sleep 5" I expect at least five seconds on the clock on my wall > to go by before the next statement is executed. That's right, However this will not happen, when you change the system time while the 5 seconds have not gone by. *t -- ----------------------------------------------------------- Tomas Pospisek http://sourcepole.com - Linux & Open Source Solutions -----------------------------------------------------------