Skip to content

Commit e30b1fb

Browse files
committed
Renamed mutex instance variable in Async to avoid naming collisions.
1 parent eda80bf commit e30b1fb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/concurrent/async.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def method_missing(method, *args, &block)
247247
#
248248
# @see Concurrent::Future
249249
def async
250-
raise InitializationError.new('#init_mutex was never called') unless @mutex
250+
raise InitializationError.new('#init_mutex was never called') unless @__async__mutex__
251251
@__async_delegator__.value
252252
end
253253
alias_method :future, :async
@@ -281,7 +281,7 @@ def async
281281
#
282282
# @see Concurrent::IVar
283283
def await
284-
raise InitializationError.new('#init_mutex was never called') unless @mutex
284+
raise InitializationError.new('#init_mutex was never called') unless @__async__mutex__
285285
@__await_delegator__.value
286286
end
287287
alias_method :delay, :await
@@ -291,7 +291,7 @@ def await
291291
# @raise [Concurrent::InitializationError] `#init_mutex` has not been called
292292
# @raise [ArgumentError] executor has already been set
293293
def executor=(executor)
294-
raise InitializationError.new('#init_mutex was never called') unless @mutex
294+
raise InitializationError.new('#init_mutex was never called') unless @__async__mutex__
295295
@__async__executor__.reconfigure { executor } or
296296
raise ArgumentError.new('executor has already been set')
297297
end
@@ -309,12 +309,12 @@ def executor=(executor)
309309
#
310310
# @raise [Concurrent::InitializationError] when called more than once
311311
def init_mutex
312-
raise InitializationError.new('#init_mutex was already called') if @mutex
313-
(@mutex = Mutex.new).lock
312+
raise InitializationError.new('#init_mutex was already called') if @__async__mutex__
313+
(@__async__mutex__ = Mutex.new).lock
314314
@__async__executor__ = Delay.new{ Concurrent.configuration.global_operation_pool }
315-
@__await_delegator__ = Delay.new{ AwaitDelegator.new(self, @mutex) }
316-
@__async_delegator__ = Delay.new{ AsyncDelegator.new(self, @__async__executor__, @mutex) }
317-
@mutex.unlock
315+
@__await_delegator__ = Delay.new{ AwaitDelegator.new(self, @__async__mutex__) }
316+
@__async_delegator__ = Delay.new{ AsyncDelegator.new(self, @__async__executor__, @__async__mutex__) }
317+
@__async__mutex__.unlock
318318
end
319319
end
320320
end

0 commit comments

Comments
 (0)