On 5/28/09, Eric Hodel <drbrain / segment7.net> wrote:
> On May 25, 2009, at 13:36, Caleb Clausen wrote:
>> Do you want your whole program to stop until some target time? In that
>> case, something as simple as
>>
>>  sleep(target_time-Time.now)
>>  code_to_be_delayed
>>
>> will do the trick nicely.
>
> Note that #sleep won't necessarily sleep as long as you like (second
> sentence):
>
> $ ri Kernel#sleep
> ----------------------------------------------------------- Kernel#sleep
>       sleep([duration])    => fixnum
>
>       From Ruby 1.8
> ------------------------------------------------------------------------
>       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.
> [...]

Is there some particular danger that Thread#run will be called on my
threads without my asking?