Last active
December 8, 2016 10:34
-
-
Save anildigital/79e71144a8e18da102244405b531c508 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
require 'concurrent' | |
event = Concurrent::Event.new | |
t1 = Thread.new do | |
puts "t1 is waiting" | |
event.wait(1) | |
puts "event ocurred" | |
end | |
t2 = Thread.new do | |
puts "t2 calling set" | |
event.set | |
end | |
[t1, t2].each(&:join) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment