From: SASADA Koichi Date: 2012-05-15T10:03:40+09:00 Subject: [ruby-core:45049] Re: [ruby-trunk - Bug #6433] rb_thread_blocking_region(): ubf() function is executed with GVL (2012/05/15 8:15), ibc (I��aki Baz Castillo) wrote: > Honestly I don't understand what "`ubf()' should interrupt `func()' execution" means :( Simple example (peudo-code): $interrupted_flag = false Thread1: begin call_without_gvl(blocking_process: ->{ while $interrupted_flag == false # do something end }, ubf: -> { $interrupted_flag = true } ) ensure if $interrupted_flag == true # can detect interrupt # you can do clean up process such as #destroy end end Thread2: thread1.raise("interrupt") Thread2 invoke ubf() and then, blocking_process() can cancel because blocking_process() checks $interrupted_flag. You can also detect interruption after that. -- // SASADA Koichi at atdot dot net