I'd like to know how can I do to create ( or instantiate ) a Ruby Thread
from C .
actually , I have to Bind Some C Modules to Ruby , So I have to manage
The ruby Thread inside my C code ( Start , Stop , Resume ...ect )
Do you you have an example of doing this from within C that you can
point to? My C isn't at an expert level, and I've had some trouble
finding an example that I can work with to do this sort of thing.
Thanks for any links or ideas.
Mike B.
路路路
On Feb 2, 7:45 am, Roger Pack <rogerpack2...@gmail.com> wrote:
> I'd like to know how can I do to create ( or instantiate ) a Ruby Thread
> from C .
I'd just lookup the Thread class and call a "new" on it, passing it a
block.
Do you you have an example of doing this from within C that you can
point to? My C isn't at an expert level, and I've had some trouble
finding an example that I can work with to do this sort of thing.
Appears there's also an rb_thread_create, though I have no idea how to
use it.
Do you you have an example of doing this from within C that you can
point to? My C isn't at an expert level, and I've had some trouble
finding an example that I can work with to do this sort of thing.
Appears there's also an rb_thread_create, though I have no idea how to
use it.
But >> `initialize': must be called with a block (ThreadError)
it seems like the Thread Class should always be called with a Block of
instrcution to execute as we do with Ruby Code Thread.new{ do .. this ..
ect }
I found Some C Methods to deal with Ruby Thread :
...
VALUE rb_thread_stop (void)
VALUE rb_thread_wakeup (VALUE)
VALUE rb_thread_run (VALUE)
VALUE rb_thread_kill (VALUE)
VALUE rb_thread_create (VALUE(*(ANYARGS), void *))
void rb_thread_interrupt (void)
void rb_thread_trap_eval (VALUE, int)
void rb_thread_signal_raise (char *)
int rb_thread_select (ANYARGS)
void rb_thread_wait_for (ANYARGS)
VALUE rb_thread_current (void)
VALUE rb_thread_main (void)
... http://ruby-doc.org/doxygen/1.8.4/group__ruby__eval.html
But not yet sure that it really create and manage a Ruby Thread (
especially that this One should be always initialized with a block of
instructions )