Hi,

At Wed, 20 May 2009 10:32:36 +0900,
John Carter wrote in [ruby-core:23506]:
> warn_printf is an unhealthy thing to have in
> rb_thread_schedule as it can (especially if you are running
> -rprofile) recurse back into rb_thread_schedule.

It should be used only just before deadlock execption.

> This is unhealthy as rb_thread_schedule uses several static
> variables and hence is not reentrant. (I discovered this when
> the deadlock detection reported deadlock even though there
> was a runnable thread! There wasn't a runnable thread, the
> recursion from warn_printf had just woken a thread.)

No static variables is used in rb_thread_schedule() directly.
You may mean rb_thread_save_context() and
rb_thread_restore_context_0()?  But warn_printf() shouldn't be
called there.

-- 
Nobu Nakada