Skip to content

Instantly share code, notes, and snippets.

@anildigital
Last active December 8, 2016 10:34
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 anildigital/79e71144a8e18da102244405b531c508 to your computer and use it in GitHub Desktop.
Save anildigital/79e71144a8e18da102244405b531c508 to your computer and use it in GitHub Desktop.
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