I'm wondering if that isn't the issue here. I took a quick look through the generated SWIG code and I don't see any Ruby threads being used for the callback.
(It looks like I accidentally replied directly to Klaus rather than the list earlier, so here's a quick catch up:)
I'm using Ruby 1.9.3p448.
using rb_thread_blocking_region() when making calls from Ruby into
native code for long operations. However,I'm not sure why
rb_thread_blocking_region() is relevant in this particular case. I'm
calling from native code *into* Ruby, not the other way around. That is,
I don't have a GIL to release at all.
includes a test.rb script, which creates an instance of the SWIG Hang
class and then sets a director via set_event_handler().
creates a native thread (using C++11) that calls back in to Ruby every 2
seconds. As soon as the first callback has been executed, however, the
Ruby VM hangs and takes no further user input. Interestingly, SWIG is
still able to continue executing callbacks; it's just that all other
Ruby execution has stopped (I can't even Ctrl+C the process)