Skip to content

Instantly share code, notes, and snippets.

@takano32
Created June 9, 2009 14:30
Show Gist options
  • Save takano32/126542 to your computer and use it in GitHub Desktop.
Save takano32/126542 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
$var = 0
puts "var: #{$var}"
a = Thread.start do; 5.times do
$var += 1
puts "a: #{$var}"
Thread.pass
end;end
b = Thread.start do; 5.times do
$var += 1
puts "b: #{$var}"
Thread.pass
end;end
a.join
b.join
puts "var: #{$var}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment