Hi,

In message "Re: Thread#raise, Thread#kill, and timeout.rb are unsafe"
    on Mon, 25 Feb 2008 16:18:01 +0900, Charles Oliver Nutter <charles.nutter / sun.com> writes:

|I wrote up an article on Thread#raise, Thread#kill, and timeout.rb that 
|I hope can start making the rounds. Long story short, neither 
|Thread#raise nor Thread#kill is safe to use, and as a result all 
|libraries that call them are also unsafe (including timeout.rb, net/*, 
|and many other libraries in the wider world).

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 admit that timeout.rb is inefficient, so that it should not be used
when performance or completeness matters.  I agree with removing use
of timeout from net/* libraries.  It's just for casual use.  Maybe
it's good to add a note in CAPITAL LETTERS in the document of
timeout.rb.

							matz.