Project

General

Profile

Bug #10443 » rb-mutex-unlock-fork-test.rb

benweint (Ben Weintraub), 10/28/2014 07:03 PM

 
#!/usr/bin/env ruby

$lock = Mutex.new

10.times do
Thread.new do
Thread.current.abort_on_exception = true
loop do
$lock.synchronize do
end
end
end
end

loop do
$stderr.write '.'
child_pid = $lock.synchronize do
Process.fork
end

if child_pid
Process.wait(child_pid)
else
exit 0
end
end
(2-2/3)