Project

General

Profile

Backport #1471 » mutual_join_bug.rb

Test script. - JohnCarter (John Carter), 05/15/2009 05:19 PM

 
require 'thread'

m = Mutex.new
m.lock
wt2 = Thread.new do
m.lock
sleep 2
m.unlock
end

# Ensure wt2 is waiting on m
sleep 0.1

wt1 = Thread.new do
m.lock
m.unlock
end
# Ensure wt1 is waiting on m
sleep 0.1

# Give it to wt2

m.unlock

wt1.join
(1-1/3)