@@ -113,7 +113,7 @@ def post(*args, &job)
113113 # post job on executor
114114 # @return [true, false]
115115 def post_on ( executor , *args , &job )
116- Concurrent . executor ( executor ) . post *args , &job
116+ Concurrent . executor ( executor ) . post ( *args , &job )
117117 end
118118
119119 # TODO add first(futures, count=count)
@@ -307,7 +307,7 @@ def set(*args, &block)
307307 # @!visibility private
308308 def complete_with ( state , raise_on_reassign = true )
309309 if @State . compare_and_set ( PENDING , state )
310- ( state )
310+ # (state)
311311 # go to synchronized block only if there were waiting threads
312312 synchronize { ns_broadcast } if @Waiters . clear
313313 call_callbacks
@@ -323,7 +323,7 @@ def complete_with(state, raise_on_reassign = true)
323323 # @return [Array<AbstractPromise>]
324324 def blocks
325325 @Callbacks . each_with_object ( [ ] ) do |callback , promises |
326- promises . push * callback . select { |v | v . is_a? AbstractPromise }
326+ promises . push ( * ( callback . select { |v | v . is_a? AbstractPromise } ) )
327327 end
328328 end
329329
@@ -464,7 +464,7 @@ def to_sym
464464 # @!visibility private
465465 class SuccessArray < Success
466466 def apply ( block )
467- block . call *value
467+ block . call ( *value )
468468 end
469469 end
470470
@@ -520,7 +520,7 @@ def reason
520520 end
521521
522522 def apply ( block )
523- block . call *reason
523+ block . call ( *reason )
524524 end
525525 end
526526
@@ -776,14 +776,14 @@ def call_callback(method, state, *args)
776776 end
777777
778778 def pr_async_callback_on_success ( state , executor , callback )
779- pr_with_async ( executor , state , callback ) do |state , callback |
780- pr_callback_on_success state , callback
779+ pr_with_async ( executor , state , callback ) do |st , cb |
780+ pr_callback_on_success st , cb
781781 end
782782 end
783783
784784 def pr_async_callback_on_failure ( state , executor , callback )
785- pr_with_async ( executor , state , callback ) do |state , callback |
786- pr_callback_on_failure state , callback
785+ pr_with_async ( executor , state , callback ) do |st , cb |
786+ pr_callback_on_failure st , cb
787787 end
788788 end
789789
@@ -804,8 +804,8 @@ def pr_callback_notify_blocked(state, promise)
804804 end
805805
806806 def pr_async_callback_on_completion ( state , executor , callback )
807- pr_with_async ( executor , state , callback ) do |state , callback |
808- pr_callback_on_completion state , callback
807+ pr_with_async ( executor , state , callback ) do |st , cb |
808+ pr_callback_on_completion st , cb
809809 end
810810 end
811811
@@ -981,7 +981,7 @@ def initialize(future, blocked_by_futures, countdown)
981981 @Countdown = AtomicFixnum . new countdown
982982
983983 super ( future )
984- @BlockedBy . each { |future | future . add_callback :pr_callback_notify_blocked , self }
984+ @BlockedBy . each { |f | f . add_callback :pr_callback_notify_blocked , self }
985985 end
986986
987987 # @api private
@@ -1063,8 +1063,8 @@ def initialize(blocked_by_future, default_executor, executor, &task)
10631063
10641064 def on_completable ( done_future )
10651065 if done_future . success?
1066- Concurrent . post_on ( @Executor , done_future , @Task ) do |done_future , task |
1067- evaluate_to lambda { done_future . apply task }
1066+ Concurrent . post_on ( @Executor , done_future , @Task ) do |future , task |
1067+ evaluate_to lambda { future . apply task }
10681068 end
10691069 else
10701070 complete_with done_future . internal_state
@@ -1082,8 +1082,8 @@ def initialize(blocked_by_future, default_executor, executor, &task)
10821082
10831083 def on_completable ( done_future )
10841084 if done_future . failed?
1085- Concurrent . post_on ( @Executor , done_future , @Task ) do |done_future , task |
1086- evaluate_to lambda { done_future . apply task }
1085+ Concurrent . post_on ( @Executor , done_future , @Task ) do |future , task |
1086+ evaluate_to lambda { future . apply task }
10871087 end
10881088 else
10891089 complete_with done_future . internal_state
@@ -1097,7 +1097,7 @@ class ChainPromise < BlockedTaskPromise
10971097
10981098 def on_completable ( done_future )
10991099 if Future === done_future
1100- Concurrent . post_on ( @Executor , done_future , @Task ) { |future , task | evaluate_to *future . result , task }
1100+ Concurrent . post_on ( @Executor , done_future , @Task ) { |future , task | evaluate_to ( *future . result , task ) }
11011101 else
11021102 Concurrent . post_on ( @Executor , @Task ) { |task | evaluate_to task }
11031103 end
0 commit comments