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;
}
--%<----------------------------------