From: Joel VanderWerf Date: 2004-05-06T01:52:55+09:00 Subject: Re: signaling another thread Ara.T.Howard wrote: > > what is is the prefered method in which one thread can 'signal' another thread > on some condition? Observable? other? One way is to use Thread#raise: $ cat thread-signal.rb class PayAttention < Exception; end other = Thread.new do i=0 begin loop do sleep 1 i += 1 # important work end rescue PayAttention puts i retry if i < 10 end end watch = Thread.new do loop do sleep 3 other.raise PayAttention end end other.join $ ruby thread-signal.rb 2 4 6 8 10 $