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