Assaph Mehr wrote: > Shashank Date wrote: > > Assaph Mehr wrote: > > > > > Silly question: Is there another thread active at the same time? I > > > don't think a thread can sleep if it's the only one... > > > > Huh? You mean the main thread cannot sleep? Or have I mis-read your > answer? > > Perhaps I wasn't clear. The main thread can of course sleep for a > specified period. But if you do a sleep 0, it means sleep until woken > up. Ruby will check, see that there is no other thread waiting and will > thus wake the main thread again. > So if you only have one thread, you can't sleep indefinitely. Oops, looks like I was wrong. See Navindra's clarification.