From: Jam Date: 2012-06-07T21:40:10+09:00 Subject: Re: Thread#kill is not rescued by "rescue Exception" On Jun 7, 2012, at 5:22 AM, Iñaki Baz Castillo wrote: > 2012/6/7 Iñaki Baz Castillo : >> So, it means that the signal send by Thread#kill is not >> "rescue--able", am I right? > > Also, I've realized about the following in C code: > > int exception_tag; > VALUE ret; > > ret = rb_protect(function, Qnil, &exception_tag); > > > If while function() is being executed (which invokes Ruby land code) > current thread is killed with Thread#kill, then rb_protect() exits > with the following ANNOYING data: > > exception_tag => int 8 > ret => VALUE FIXNUM 8 > > If after that I do: > > VALUE exception = rb_errinfo(); > > Then I get VALUE FIXNUM 8. Yes, rb_errinfo() returns FIXNUM 8 !!! > > > -- > Iñaki Baz Castillo > > As far as rescuing kill, you could open the Thread class and reimplementing kill to throw an exception. There's a piece of me that thinks that's a really bad idea, though.