Skip to content

Instantly share code, notes, and snippets.

@choallin
Created June 18, 2019 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save choallin/d453784776fd91028cb3ab26a9b4834b to your computer and use it in GitHub Desktop.
Save choallin/d453784776fd91028cb3ab26a9b4834b to your computer and use it in GitHub Desktop.
resource_a = []
threads = []
threads << Thread.new do |t|
50.times do |i|
resource_a << i
end
end
threads << Thread.new do |t|
50.times do |i|
resource_a << i
end
end
threads.each &:join
puts resource_a.length # will output 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment