File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 1
1
module Concurrent
2
2
3
- # Safe synchronization under any Ruby implementation
3
+ # Safe synchronization under any Ruby implementation.
4
+ # It provides methods like {#synchronize}, {#wait}, {#signal} and {#broadcast}.
4
5
# Provides a single layer which can improve its implementation over time without changes needed to
5
6
# the classes using it. Use {SynchronizedObject} not this abstract class.
6
- # @example
7
+ #
8
+ # @note this object does not support usage together with {Thread#wakeup} and {Thread#raise}.
9
+ # `Thread#sleep` and `Thread#wakeup` will work as expected but mixing `SynchronizedObject#wait` and
10
+ # `Thread#wakeup` will not work on all platforms.
11
+ #
12
+ # @see {Event} implementation as an example of this class use
13
+ #
14
+ # @example simple
7
15
# class AnClass < SynchronizedObject
8
16
# def initialize
9
17
# super
@@ -82,7 +90,7 @@ def ns_wait_until(timeout, &condition)
82
90
end
83
91
84
92
# @return [self]
85
- def ns_wait ( timeout )
93
+ def ns_wait ( timeout = nil )
86
94
raise NotImplementedError
87
95
end
88
96
@@ -155,7 +163,7 @@ def ns_broadcast
155
163
self
156
164
end
157
165
158
- def ns_wait ( timeout )
166
+ def ns_wait ( timeout = nil )
159
167
@__condition__do_not_use_directly . wait @__lock__do_not_use_directly , timeout
160
168
self
161
169
end
@@ -173,7 +181,7 @@ def synchronize
173
181
174
182
private
175
183
176
- def ns_wait ( timeout )
184
+ def ns_wait ( timeout = nil )
177
185
@__condition__do_not_use_directly . wait timeout
178
186
self
179
187
end
You can’t perform that action at this time.
0 commit comments