hi,
Question related to extending ruby
I have a class derived from a swigged c++ class
i.e.

class MyClass < Gm:GMClass

        def initialize()
                super()
        end

        def construct()
                @node = Gm::GMNode.new("name")
                #just to test
                ObjectSpace.garbage_collect
        end
end

I create an instance of MyClass using rb_load_protect and
then call the construct method using rb_funcall. The problem is
that if I create the instance in one c++ thread and then call the
construct method in another c++ thread I get the following error
when gc is invoked

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 8194 (LWP 1036)]
mark_locations_array (x=0x41845000, n=530508239) at gc.c:501

#1  0x08072c89 in rb_gc () at gc.c:1208
#2  0x08072d7b in rb_gc_start () at gc.c:1245
#3  0x0806ced3 in call_cfunc (func=0x8072d70 <rb_gc_start>, recv=1090738928, 
len=0, argc=0, argv=0x0) at eval.c:4547
#4  0x08063019 in rb_call0 (klass=1090738868, recv=1090738928, id=9505, 
oid=0, argc=0, argv=0x0, body=0x41035a50, nosuper=1) at eval.c:4684
#5  0x080637a1 in rb_call (klass=1090738868, recv=1090738928, mid=9505, 
argc=0, argv=0x0, scope=0) at eval.c:4901
#6  0x0805f05b in rb_eval (self=1090733368, n=0x0) at eval.c:2816
#7  0x080632f8 in rb_call0 (klass=1090733588, recv=1090733368, id=10053, 
oid=0, argc=0, argv=0x418449e0, body=0x41034920, nosuper=0) at eval.c:4812
#8  0x080637a1 in rb_call (klass=1090733588, recv=1090733368, mid=10053, 
argc=1, argv=0x418449dc, scope=1) at eval.c:4901
#9  0x08063a73 in rb_funcall2 (recv=0, mid=10053, argc=1, argv=0x418449dc) 
at ruby.h:615

The problem dissapears if call both from the same thread. I do remember 
seeing something about ruby not being thread safe but can't now find where 
I saw this
I'm using ruby 1.8.0 (2003-03-03) [i686-linux], swig 1.3.19
Any help much appreciated
Cheers