Hi,

(2012/05/15 4:15), ibc (Iaki Baz Castillo) wrote:
> You can reproduce it by downloading it (Ruby 1.9.2 or perhasp 1.9.3 required):

Thank you.  But I want to read a *small* code....

Okay, maybe I understand your problem.

Let us clear them:
(1) There are several threads and main threads
(2) main thread kills another blocking thread

Right?

In this case, ubf() will be called by a thread "Thread#kill" (or signal,
etc).  Main thread has GVL, and call ubf() to cancel another thread.
This is why the error occurs.

FYI:
>> /usr/lib/libruby-1.9.1.so.1.9(rb_thread_kill+0x48) [0x7fdcfff680a8]
is Thread#kill code.

Maybe you expect that ubf() was called by *blocking* thread.  However,
it is not.

In last comment, I made a mistake that "ubf() is not called with GVL".
It's my mistake.  Correct answer is "ubf() is possible to be called
with/without GVL".

We can't use "call_with_gvl()" in ubf().


You need call shutdown/destruct codes *after* unblocking.


Regards,
Koichi

-- 
// SASADA Koichi at atdot dot net