From: rakaur Date: 2006-02-17T17:03:28+09:00 Subject: Re: cross-thread violation require 'timeout' Thread.new do begin Timeout.new(10) do sleep(11) end rescue Timeout::Error puts "trying again" retry end end loop { sleep(1) } This kills it on FreeBSD 4.11, but not on Linux 2.6.13. Note that "Timeout.new" is invalid, but that's how I got it to do it in the first place. I was trying to make use of Timeouts to do a hacky timer system (eg, a block that's run every N seconds). I figured by doing: Thread.new do begin Timeout::timeout(N) { sleep(N + 1) } rescue Timeout::Error # some code to run every N seconds retry end end I could accomplish that. By making the mistake Timeout.new instead of Timeout::timeout is how I originally caused this to happen. After changing it to Timeout::timeout it does work as I intended.