>>>>> "Y" == Yukihiro Matsumoto <matz / ruby-lang.org> writes:

Y> Sorry for being stupid, but rb_trap_immediate is turned off in the
Y> restore_context, so thread_timer only set rb_thread_pending to 1 at
Y> most during the function execution, thus context switch would not
Y> happen even when tb_thread_critical is not set, right?

 If I'm right this is the interaction between pthreads (POSIX) and rthreads
 (ruby) which give the problem.

 When it's blocked this is because the pthreads are blocked.

 For what I've seen when it was blocked (with gdb)

   * ruby receive a signal in setcontext()
   * thread_timer() is called which call nanosleep()
   * the rthread is restored
   * it end with the pthreads blocked


Guy Decoux