Issue #6433 has been updated by ko1 (Koichi Sasada).

Target version changed from 1.9.2 to 2.0.0

Need to check document (someone's helps are welcome!)
----------------------------------------
Bug #6433: rb_thread_blocking_region(): ubf() function is executed with GVL
https://bugs.ruby-lang.org/issues/6433#change-31959

Author: ibc (IƱaki Baz Castillo)
Status: Assigned
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: ext
Target version: 2.0.0
ruby -v: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]


thread.c says:

------------------------
 *   If another thread interrupts this thread (Thread#kill, signal delivery,
 *   VM-shutdown request, and so on), `ubf()' is called (`ubf()' means
 *   "un-blocking function").  `ubf()' should interrupt `func()' execution.

 *   NOTE: You can not execute most of Ruby C API and touch Ruby
 *         objects in `func()' and `ubf()', including raising an
 *         exception, because current thread doesn't acquire GVL
 *         (cause synchronization problem).

VALUE
rb_thread_blocking_region(
   rb_blocking_function_t *func, void *data1,
   rb_unblock_function_t *ubf, void *data2)

--------------------------


I've created my ubf() function which is called when the Ruby thread in which rb_thread_blocking_region() was called is killed or interrupted. Within my ubf() function I expect not to have the GVL (as the doc says) and I need to run Ruby code, so I use:

  rb_thread_call_with_gvl(terminate_my_C_reactor_with_gvl, NULL);

and I get an error:

 [BUG] rb_thread_call_with_gvl: called by a thread which has GVL.

So... is ubf() called with the GVL or not??


-- 
http://bugs.ruby-lang.org/