From: Sean Russell Date: 2002-05-25T08:36:46+09:00 Subject: Re: Threading oddness Dossy wrote: > Perhaps Thread needs a little event handler for thread death? So, > you could do something like: I'm not yet sure that anything /needs/ fixing except for my brain. However, I would find it more intuitive if exceptions that occurred within threads were handled similarly to exceptions outside of the thread: at the very least, you get a dump to the console letting you know that something went wrong. > The only problem is the race condition: the time between when the > thread is started and when the #on_exception message gets sent > to the thread. Hm. Yes. I was thinking (as I said) of something more like a default wrapper for thread handling like Ruby already has for the main thread. Really, though, you can fix the problem if you just remember: n = Thread.new { begin #... rescue #... end } Hmm... this gets me thinking: you can already do: def blah #... rescue #... end Right? How about some more syntactic sugar for Ruby: allow blocks to be defined the same way as methods, so that: n = Thread.new do #... rescue #... end -- |.. "All I ask is a chance to prove that money can't make me happy." <|> -- anon /|\ /| |