Os-thread synchronize with ruby

hello,

I have a c-extension with has to threads. A main-thread (A) and a
other thread (B).
Thread B is waiting for events and then it puts data in a list.
If this occur a ruby-block should be called. But when I do this
in this thread, ruby crash.

Of course, because this thread is not the thread in which ruby
is running.
My extension is all c-code.

Is there a method to synchronize this?
i.e., to say ruby, that this block should be running, and ruby
controls when the block is executed. So, that the threads are not
confused.

I call the thread in this way:

···


VALUE block, res;
block = rb_thread_local_aref(rb_thread_current(), rb_intern(“block”));
res = rb_funcall(block, rb_intern(“call”), 0 );

daniel

I have a c-extension with has to threads. A main-thread (A) and a
other thread (B).
Thread B is waiting for events and then it puts data in a list.
If this occur a ruby-block should be called. But when I do this
in this thread, ruby crash.

Don't try to mix OS thread with ruby thread

Guy Decoux