From: MenTaLguY Date: 2008-03-15T03:54:15+09:00 Subject: Re: Thread#raise, Thread#kill, and timeout.rb are unsafe On Fri, 14 Mar 2008 23:42:37 +0900, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Thread#raise, Thread#kill, and timeout.rb are unsafe" > on Fri, 14 Mar 2008 22:32:33 +0900, Paul Brannan > writes: > > |I wonder if there should be an equivalent trap mechanism for other > |asynchronous exceptions? > > Probably. Does anyone have any idea? The simplest way to "tame" asynchronous exceptions would be to enqueue such exceptions until the recieving thread makes a blocking call, or else it calls a special method like Thread.check_interrupts. The main difficulty with the idea is defining clearly what a "blocking call" is. There probably also needs to be some mechanism (which does not "stop the world" like Thread.critical) to mask asynchronous exceptions even during blocking calls, for particularly critical code. -mental