> I am no expert on Ruby threading so this is just a guess: > > When the new thread (th) is created and it encounters the sleep(5) it gets > "descheduled" (may not be the right technical term). Now the main thread is > scheduled to run and waits till you hit the key also blocking the other > thread till then. You hit the key, the main thread continues and calls > th.run which causes th to restart. Try replacing th.run with th.join and see > if the whole thing hangs (not a good thing I admit ;-)) > > HTH, > -- shanko took a little peek at the ruby source, rb_sleep_forever() (the behaviour I was looking for) was called only if no parameters were supplied (argc == 0) when calling sleep. This is abit confusing in relation to what "ri sleep" says: "...An argument of zero causes sleep to sleep forever..." I interpreted that as using 0 as an argument would make it sleep forever. (And is forever really a good way of saying it? I'd call it making the thread dormant (heck I'd even like a seperate method for just that behavior). -- Bj?rn