Issue #5130 has been updated by Motohiro KOSAKI. First, we can't apply your nor Eric's patch because it's racy. Your patch care following scenario. 1) thread-A create thread-B 2) thread-A call terminate_all 3) thread-B start but, it doesn't care following scenario. 1) thread-A create thread-B 2) thread-B start (just after) 3) thread-A call terminate_all Moreover, we shouldn't need a special care about thread starting. it should works as well. I don't plan to apply your ugly bandaid patch. Second, your analysis is not accurate. The complete opnebsd failed scenario is here. (OMG, I needed to install openbsd). thread-A thread-B --------------------------------------- -> gvl_yield vm->gvl.wait_yield = 1; -> sched_yield -> gvl_yield -> cond_wait(switch_wait_cond) # wait until waking up sched_yield() -> task-state change to COND_WAIT <- sched_yield vm->gvl.wait_yield = 0; -> pthread_cond_broadcast() -> task-state of thread-B change to RUNNING <- gvl_yield -> gvl_yield vm->gvl.wait_yield = 1; -> sched_yield <- cond_wait(switch_wait_cond) *** Oh, wait_yield is 1. try to sleep again. -> cond_wait(switch_wait_cond) That's all. rb_thread_terminate_all() called rb_thread_schedule() repeatedly. and waking-up cond_wait(switch_wait_cond) failed repeatedly. OpenBSD's user land pthread library makes semi deterministic scheduling. and then, the test code can't bail out forever. btw, sched_yield() works as expected on OpenBSD. then, I don't change sched_yield() call at least now. ---------------------------------------- Bug #5130: Thread.pass sticks on OpenBSD http://redmine.ruby-lang.org/issues/5130 Author: Yui NARUSE Status: Assigned Priority: Normal Assignee: Motohiro KOSAKI Category: core Target version: ruby -v: ruby 2.0.0dev (2011-11-07 trunk 33648) [x86_64-openbsd5.0] =begin On OpenBSD 4.9, following script will stick. ./miniruby -ve'Thread.new{Thread.pass}' =end -- http://redmine.ruby-lang.org