Skip to content

Commit 67d6631

Browse files
committed
Merge pull request #204 from rkday/fix_up_warnings
Fix up warnings
2 parents a66d78c + c192d07 commit 67d6631

11 files changed

+14
-16
lines changed

doc/thread_pools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A Thread Pool is an abstraction that you can give a unit of work to, and the wor
66

77
But there are some problems for which directly using a thread pool is an appropriate solution. Or, you may wish to make your own thread pool to run Futures on, to be separate or have different characteristics than the global thread pool that Futures run on by default.
88

9-
Thread pools are considered 'executors' -- an object you can give a unit of work to, to have it execucted. In fact, thread pools are the main kind of executor you will see - others are mainly for testing or odd edge cases. In some documentation or source code you'll see reference to an 'executor' -- this is commonly a thread pool, or else something similar that executes units of work (usually supplied as Ruby blocks).
9+
Thread pools are considered 'executors' -- an object you can give a unit of work to, to have it executed. In fact, thread pools are the main kind of executor you will see - others are mainly for testing or odd edge cases. In some documentation or source code you'll see reference to an 'executor' -- this is commonly a thread pool, or else something similar that executes units of work (usually supplied as Ruby blocks).
1010

1111
## FixedThreadPool
1212

lib/concurrent/async.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ def method_missing(method, *args, &block)
8181
super unless @delegate.respond_to?(method)
8282
Async::validate_argc(@delegate, method, *args)
8383

84-
self.define_singleton_method(method) do |*args|
85-
Async::validate_argc(@delegate, method, *args)
84+
self.define_singleton_method(method) do |*args2|
85+
Async::validate_argc(@delegate, method, *args2)
8686
ivar = Concurrent::IVar.new
8787
value, reason = nil, nil
8888
@serializer.post(@executor.value) do
8989
begin
90-
value = @delegate.send(method, *args, &block)
90+
value = @delegate.send(method, *args2, &block)
9191
rescue => reason
9292
# caught
9393
ensure

lib/concurrent/atomic/atomic_fixnum.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ module Concurrent
2525
class MutexAtomicFixnum
2626

2727
# http://stackoverflow.com/questions/535721/ruby-max-integer
28-
MIN_VALUE = -(2**(0.size * 8 -2))
29-
MAX_VALUE = (2**(0.size * 8 -2) -1)
28+
MIN_VALUE = -(2**(0.size * 8 - 2))
29+
MAX_VALUE = (2**(0.size * 8 - 2) - 1)
3030

3131
# @!macro [attach] atomic_fixnum_method_initialize
3232
#

lib/concurrent/executor/indirect_immediate_executor.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def post(*args, &task)
2828
return false unless running?
2929

3030
event = Concurrent::Event.new
31-
internal_executor.post do
31+
@internal_executor.post do
3232
begin
3333
task.call(*args)
3434
ensure
@@ -39,8 +39,5 @@ def post(*args, &task)
3939

4040
true
4141
end
42-
43-
private
44-
attr_reader :internal_executor
4542
end
4643
end

lib/concurrent/executor/ruby_thread_pool_worker.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def initialize(queue, parent)
1313
@parent = parent
1414
@mutex = Mutex.new
1515
@last_activity = Time.now.to_f
16+
@thread = nil
1617
end
1718

1819
# @!visibility private

lib/concurrent/executor/serialized_execution.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class SerializedExecution
1212

1313
Job = Struct.new(:executor, :args, :block) do
1414
def call
15-
block.call *args
15+
block.call(*args)
1616
end
1717
end
1818

lib/concurrent/lazy_register.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def register(key, &block)
4949
# @return self
5050
# @param [Object] key
5151
def unregister(key)
52-
@data.update { |h| h.dup.tap { |h| h.delete(key) } }
52+
@data.update { |h| h.dup.tap { |j| j.delete(key) } }
5353
self
5454
end
5555

lib/concurrent/observable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def add_observer(*args, &block)
4646
# as #add_observer but it can be used for chaining
4747
# @return [Observable] self
4848
def with_observer(*args, &block)
49-
add_observer *args, &block
49+
add_observer(*args, &block)
5050
self
5151
end
5252

lib/concurrent/promise.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def then(rescuer = nil, &block)
100100
# @return [Promise]
101101
def on_success(&block)
102102
raise ArgumentError.new('no block given') unless block_given?
103-
self.then &block
103+
self.then(&block)
104104
end
105105

106106
# @return [Promise]

lib/concurrent/scheduled_task.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def initialize(intended_time, opts = {}, &block)
2626
def execute
2727
if compare_and_set_state(:pending, :unscheduled)
2828
@schedule_time = TimerSet.calculate_schedule_time(@intended_time)
29-
Concurrent::timer(@schedule_time.to_f - Time.now.to_f) { @executor.post &method(:process_task) }
29+
Concurrent::timer(@schedule_time.to_f - Time.now.to_f) { @executor.post(&method(:process_task)) }
3030
self
3131
end
3232
end

0 commit comments

Comments
 (0)