@@ -108,9 +108,6 @@ def validate_argc(obj, method, *args)
108
108
# @!visibility private
109
109
class AwaitDelegator # :nodoc:
110
110
111
- # The lock used when delegating methods to the wrapped object.
112
- attr_reader :mutex
113
-
114
111
# Create a new delegator object wrapping the given +delegate+ and
115
112
# protecting it with the given +mutex+.
116
113
#
@@ -153,16 +150,18 @@ def method_missing(method, *args, &block)
153
150
154
151
self . send ( method , *args )
155
152
end
153
+
154
+ # The lock used when delegating methods to the wrapped object.
155
+ #
156
+ # @!visibility private
157
+ attr_reader :mutex # :nodoc:
156
158
end
157
159
158
160
# Delegates asynchronous, thread-safe method calls to the wrapped object.
159
161
#
160
162
# @!visibility private
161
163
class AsyncDelegator # :nodoc:
162
164
163
- # The lock used when delegating methods to the wrapped object.
164
- attr_reader :mutex
165
-
166
165
# Create a new delegator object wrapping the given +delegate+ and
167
166
# protecting it with the given +mutex+.
168
167
#
@@ -199,6 +198,13 @@ def method_missing(method, *args, &block)
199
198
200
199
self . send ( method , *args )
201
200
end
201
+
202
+ private
203
+
204
+ # The lock used when delegating methods to the wrapped object.
205
+ #
206
+ # @!visibility private
207
+ attr_reader :mutex # :nodoc:
202
208
end
203
209
204
210
# Causes the chained method call to be performed asynchronously on the
@@ -229,7 +235,7 @@ def method_missing(method, *args, &block)
229
235
#
230
236
# @see Concurrent::Future
231
237
def async
232
- @__async_delegator__ ||= AsyncDelegator . new ( self , Mutex . new )
238
+ @__async_delegator__ ||= AsyncDelegator . new ( self , await . mutex )
233
239
end
234
240
alias_method :future , :async
235
241
@@ -261,7 +267,7 @@ def async
261
267
#
262
268
# @see Concurrent::IVar
263
269
def await
264
- @__await_delegator__ ||= AwaitDelegator . new ( self , async . mutex )
270
+ @__await_delegator__ ||= AwaitDelegator . new ( self , Mutex . new )
265
271
end
266
272
alias_method :defer , :await
267
273
end
0 commit comments