1 shared :thread_exit do |cmd|
2 describe "Thread\##{cmd}" do
4 # This case occurred in JRuby where native threads are used to provide
5 # the same behavior as MRI green threads. Key to this issue was the fact
6 # that the thread which called #exit in its block was also being explicitly
7 # sent #join from outside the thread. The 100.times provides a certain
8 # probability that the deadlock will occur. It was sufficient to reliably
9 # reproduce the deadlock in JRuby.
10 it "does not deadlock when called from within the thread while being joined from without" do
12 t = Thread.new { Thread.stop; Thread.current.send(cmd) }
13 Thread.pass until t.status == "sleep"