--- thread.c.orig Wed Aug 3 14:10:10 2011 +++ thread.c Wed Aug 3 14:10:12 2011 @@ -429,6 +429,14 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_star rb_thread_t *join_th; rb_thread_t *main_th; VALUE errinfo = Qnil; + + if (GET_VM()->inhibit_thread_creation) { + thread_debug("not starting thread due to interpreter shutdown: %p\n", (void *)th); + thread_cleanup_func(th, FALSE); + st_delete(th->vm->living_threads, th, NULL); + return 1; + } + # ifdef USE_SIGALTSTACK void rb_register_sigaltstack(rb_thread_t *th);