Skip to content

Commit 2895b55

Browse files
committed
Merge remote-tracking branch 'upstream/pr/613'
* upstream/pr/613: (2 commits) The output should be commented in the example itself ...
2 parents a261263 + d9e8787 commit 2895b55

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/concurrent/atomic/event.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ module Concurrent
1313
# `#reset` at any time once it has been set.
1414
#
1515
# @see http://msdn.microsoft.com/en-us/library/windows/desktop/ms682655.aspx
16+
# @example
17+
# event = Concurrent::Event.new
18+
#
19+
# t1 = Thread.new do
20+
# puts "t1 is waiting"
21+
# event.wait(1)
22+
# puts "event ocurred"
23+
# end
24+
#
25+
# t2 = Thread.new do
26+
# puts "t2 calling set"
27+
# event.set
28+
# end
29+
#
30+
# [t1, t2].each(&:join)
31+
#
32+
# # prints:
33+
# # t2 calling set
34+
# # t1 is waiting
35+
# # event ocurred
1636
class Event < Synchronization::LockableObject
1737

1838
# Creates a new `Event` in the unset state. Threads calling `#wait` on the

0 commit comments

Comments
 (0)