Skip to content

Instantly share code, notes, and snippets.

@rue
Created April 15, 2009 14:12
Show Gist options
  • Select an option

  • Save rue/95791 to your computer and use it in GitHub Desktop.

Select an option

Save rue/95791 to your computer and use it in GitHub Desktop.
$val = :hi
$outer = false
$inner = false
t1 = Thread.new do
begin
$outer = true
t2 = Thread.new do
begin
$inner = true
sleep
ensure
$val = :moo
end
end
until $inner
Thread.pass
end
Thread.current.kill
ensure
t2.kill
t2.join
end
end
until $outer and $inner
Thread.pass
end
#t1.kill
t1.join
p $val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment