(2012/05/15 8:15), ibc (Iaki 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