On Fri, Mar 14, 2008 at 01:02:52AM +0900, Yukihiro Matsumoto wrote:
> Unlike Java, Thread#raise etc. should be treated similar to
> KeyboardInterrupt in Ruby.  No realtime exception posting is expected.
> If you handle KeyboardInterrupt safely, do same thing for Thread#raise
> etc., e.g. just turning on flags to reserve exception, then raise
> exception at the safe place, as MRI does.  Nothing more is required.

I'm not convinced KeyboardInterrupt can be handled safely, either, in a
script.  What happens if a KeyboardInterrupt exception is raised inside
an ensure block?  It could easily result in resource leaks.

I think the right way to handle signals and timeouts is either in an
event loop or a dedicated thread.  Asynchronous exceptions are
convenient but error-prone.

Paul