Soren Dreijer
2013-10-09 16:48:59 UTC
Hi folks!
I'm using directors in my Ruby SWIG project to allow C++ code to call back
in to Ruby. I have an interface defined like so:
%feature("director") IHostEventHandler;
In Ruby, I instantiate a class that derives from IHostEventHandler and then
pass that to my C++ code via a SWIGified function.
For testing purposes, when the IHostEventHandler is registered, I create a
C++ thread which calls one of the methods on the IHostEventHandler
interface every 2 seconds.
The call correctly comes in to Ruby. However, once the call returns, the
Ruby VM appears to be in a funky state and I'm no longer able to execute
other commands on the console. Interestingly, the C++ code is still able to
call in to Ruby via the interface; it's just like everything else in the
Ruby VM has stopped working.
Am I misunderstanding how directors work in Ruby? Is it perhaps wrong for
me to execute the callback on a non-Ruby thread?
Any help greatly appreciated,
Soren
I'm using directors in my Ruby SWIG project to allow C++ code to call back
in to Ruby. I have an interface defined like so:
%feature("director") IHostEventHandler;
In Ruby, I instantiate a class that derives from IHostEventHandler and then
pass that to my C++ code via a SWIGified function.
For testing purposes, when the IHostEventHandler is registered, I create a
C++ thread which calls one of the methods on the IHostEventHandler
interface every 2 seconds.
The call correctly comes in to Ruby. However, once the call returns, the
Ruby VM appears to be in a funky state and I'm no longer able to execute
other commands on the console. Interestingly, the C++ code is still able to
call in to Ruby via the interface; it's just like everything else in the
Ruby VM has stopped working.
Am I misunderstanding how directors work in Ruby? Is it perhaps wrong for
me to execute the callback on a non-Ruby thread?
Any help greatly appreciated,
Soren