Created
June 18, 2019 16:06
-
-
Save choallin/d453784776fd91028cb3ab26a9b4834b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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