Project

General

Profile

Actions

Bug #6433

closed

rb_thread_blocking_region(): ubf() function is executed with GVL

Added by ibc (Iñaki Baz Castillo) over 12 years ago. Updated about 12 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Backport:
[ruby-core:45035]

Description

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??

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0