Hello,
Could somebody tell me what’s wrong with the attached piece of code?
A ruby thread is created before entering the interpreter’s main loop.
It segfault when the interpreter exits.
Thanks in advance.
_gilles.
–%<----------------------------------
#include “ruby.h”
static VALUE my_thread(void *data)
{
while (1) {
// do something
rb_thread_schedule();
}
return Qtrue;
}
int
main(argc, argv, envp)
int argc;
char **argv, **envp;
{
ruby_init();
ruby_options(argc, argv);
rb_thread_create(my_thread, NULL);
ruby_run();
return 0;
}
–%<----------------------------------
Yukihiro Matsumoto wrote:
Hi,
Could somebody tell me what’s wrong with the attached piece of code?
A ruby thread is created before entering the interpreter’s main loop.
It segfault when the interpreter exits.
This may be fixed by:
* eval.c (rb_thread_create): may called from place higher than
rb_gc_stack_start.
* gc.c (Init_stack): update rb_gc_stack_start if it is lower (or
higher if stack grows down) than the previous value.
Could you try the latest CVS?
matz.
It’s OK with latest CVS.
This bug was related to MPI Ruby being broken. I need to do some more
testing but at least it doesn’t segfault with one node.
Thanks.
_gilles.
···
In message “rb_thread_create / rb_thread_schedule” > on 03/02/25, Gilles Filippini gilles.filippini@free.fr writes:
Sat Feb 22 02:45:20 2003 Yukihiro Matsumoto matz@ruby-lang.org