Notes posted by colinsurprenant

RSS feed
October 3, 2011 - (>= v1_9_1_378)
0 thanks

example will not work in 1.9+

Since 1.9 introduces native threads, we cannot assume the order of exectution and the example above is not thread safe and fails with a “deadlock detected (fatal)” error. Also Thread.pass is pointless in the context of native threads.

This will work as intended with native threads:

a = Thread.new { print "a"; Thread.stop; print "c" } 
sleep(0.1) until a.status == 'sleep'
print "b"