On Sat, 23 Nov 2002 11:32:50 +0900, Chris wrote:
> Hello,
> 
> I found that some old code that had once worked just sort of
> stopped working. It turns out that Thread.new do ... end wasn't
> doing anything; it may as well have been a comment.
> 
> So I ran the following test:
> 
> Thread.new do
>   raise 'Your faith in Thread was well-placed.'
> end
> time = Time.now + 1
> while (Time.now <time)
>   Thread.pass
> end

Thread.new do
  begin
    raise 'Your faith in Thread was well-placed.'
  rescue => ex
    puts ex.message
  end
y

time = Time.now + 1

while (Time.now < time)
  Thread.pass
end

> It just sat there for a second, then was done. No exception was
> raised. This was on my ruby 1.7.2 (2002-07-02) [i386-mswin32]
> machine. So, I tried it on my ruby 1.7.3 (2002-10-09) [i686-linux]
> machine, and it did the same thing: one second of nothing.
> 
> I know threads didn't just 'stop working' all over the world just
> now, so it must be me. What am I doing wrong??

Unless Thread#abort_on_exception is true, exceptions in threads
won't be propagated to the main thread. This bit me in a program
recently.

-austin
-- Austin Ziegler, austin / halostatue.ca on 2002.11.22 at 22.29.39