It looks like the use of directors for Ruby doesn't ensure that the calling thread is actually a native Ruby thread. That is, SWIG blindly makes the call to Ruby-land from any thread rather than marshalling the call to a Ruby thread first.
Calls to Ruby must happen on a Ruby thread (http://burgestrand.se/articles/asynchronous-callbacks-in-ruby-c-extensions.html) or otherwise the Ruby VM gets mighty upset: http://comments.gmane.org/gmane.comp.programming.swig/19854
A repro is available here: https://dl.dropboxusercontent.com/u/2406449/Swig/SwigRubyHang.7z
A fix is fairly trivial: All director calls should just be marshalled to a Ruby thread with e.g. rb_thread_create().
Log in to post a comment.