Skip to content

Commit f0d39c5

Browse files
committed
Merge pull request #385 from ruby-concurrency/warnings
Cleared all interpreter warnings.
2 parents 8dfeed0 + 22237f7 commit f0d39c5

File tree

14 files changed

+55
-46
lines changed

14 files changed

+55
-46
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ matrix:
2727
- rvm: jruby-head
2828
- rvm: 1.9.3
2929

30-
script: bundle exec rake ci
30+
script: RUBYOPT=-w bundle exec rake ci

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
### Upcoming Release v0.9.1 (TBD)
22

3+
* Fixed a Rubiniux bug in synchronization object
4+
* Fixed all unterpreter warnings (except circular references)
5+
* Fixed requires when requiring Atom alone
6+
* Significantly improved `ThreadLocalVar` on non-JRuby platforms
7+
* Fixed error handling in Edge `Concurrent.zip`
38
* `AtomicFixnum` methods `#increment` and `#decrement` now support optional delta
9+
* New AtomicFixnum#update` method
10+
* Minor optimizations in `ReadWriteLock`
11+
* New `ReentrantReadWriteLock` class
12+
* `ThreadLocalVar#bind` method is now public
413

514
## Current Release v0.9.0 (10 July 2015)
615

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ Derived from Ruby's [Struct](http://ruby-doc.org/core-2.2.0/Struct.html):
105105
* [Thread-local variables](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ThreadLocalVar.html)
106106
* [Software transactional memory](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/TVar.html) (TVar)
107107
* [ReadWriteLock](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ReadWriteLock.html)
108+
* [ReentrantReadWriteLock](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/ReentrantReadWriteLock.html)
108109

109110
### Edge Features
110111

@@ -127,7 +128,8 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m
127128
* [Exchanger](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Exchanger.html)
128129
* [LazyRegister](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/LazyRegister.html)
129130
* [Atomic Markable Reference](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/AtomicMarkableReference.html)
130-
* [Lock Free Linked Set](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/LockFreeLinkedSet.html)
131+
* [LockFreeLinked Set](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/LockFreeLinkedSet.html)
132+
* [LockFreeStack](http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/Edge/LockFreeStack.html)
131133

132134
#### Statuses:
133135

@@ -139,8 +141,7 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m
139141
- **Channel** - Missing documentation; limted features; stability good.
140142
- **Exchanger** - Known race condition requiring a new implementation.
141143
- **LazyRegister** - Missing documentation and tests.
142-
- **AtomicMarkableReference** - Needs real world battle testing
143-
- **LockFreeLinkedSet** - Needs real world battle testing
144+
- **AtomicMarkableReference, LockFreeLinkedSet, LockFreeStack** - Needs real world battle testing
144145

145146
## Usage
146147

@@ -184,8 +185,6 @@ require 'concurrent/actor' # Concurrent::Actor and supporting code
184185
require 'concurrent/edge/future' # new Future Framework
185186
require 'concurrent/agent' # Concurrent::Agent
186187
require 'concurrent/channel ' # Concurrent::Channel and supporting code
187-
require 'concurrent/exchanger' # Concurrent::Exchanger
188-
require 'concurrent/lazy_register' # Concurrent::LazyRegister
189188
```
190189

191190
If the library does not behave as expected, `Concurrent.use_stdlib_logger(Logger::DEBUG)` could help to reveal the problem.

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ install:
99
build: off
1010

1111
test_script:
12-
- bundle exec rake ci
12+
- RUBYOPT=-w bundle exec rake ci
1313

1414
environment:
1515
matrix:

lib/concurrent/actor/core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def ns_initialize(opts, &block)
208208
end
209209

210210
def initialize_behaviours(opts)
211-
@behaviour_definition = (Type! opts[:behaviour_definition] || @context.behaviour_definition, Array).each do |(behaviour, *args)|
211+
@behaviour_definition = (Type! opts[:behaviour_definition] || @context.behaviour_definition, Array).each do |(behaviour, _)|
212212
Child! behaviour, Behaviour::Abstract
213213
end
214214
@behaviours = {}

lib/concurrent/actor/utils/pool.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def initialize(size, &worker_initializer)
3737
end
3838

3939
def on_message(message)
40-
command, *rest = message
40+
command, _ = message
4141
return if [:restarted, :reset, :resumed, :terminated].include? command # ignore events from supervised actors
4242

4343
envelope_to_redirect = if envelope.future

lib/concurrent/collection/copy_on_notify_observer_set.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def duplicate_and_clear_observers
100100
end
101101

102102
def duplicate_observers
103-
synchronize { observers = @observers.dup }
103+
synchronize { @observers.dup }
104104
end
105105

106106
def notify_to(observers, *args)

lib/concurrent/configuration.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
require 'thread'
2-
require 'concurrent/atomics'
2+
require 'concurrent/delay'
33
require 'concurrent/errors'
4-
require 'concurrent/executors'
4+
require 'concurrent/atomic/atomic_reference'
55
require 'concurrent/concern/deprecation'
66
require 'concurrent/concern/logging'
7+
require 'concurrent/executor/timer_set'
8+
require 'concurrent/executor/immediate_executor'
9+
require 'concurrent/executor/fixed_thread_pool'
10+
require 'concurrent/executor/thread_pool_executor'
711
require 'concurrent/utility/at_exit'
812
require 'concurrent/utility/processor_counter'
913

@@ -32,8 +36,8 @@ def self.create_stdlib_logger(level = Logger::FATAL, output = $stderr)
3236
formatted_message
3337
end
3438

35-
lambda do |level, progname, message = nil, &block|
36-
logger.add level, message, progname, &block
39+
lambda do |loglevel, progname, message = nil, &block|
40+
logger.add loglevel, message, progname, &block
3741
end
3842
end
3943

lib/concurrent/delay.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'thread'
2-
require 'concurrent/configuration'
32
require 'concurrent/concern/obligation'
43
require 'concurrent/executor/executor'
54
require 'concurrent/executor/immediate_executor'

lib/concurrent/edge/future.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)