Permalink
Browse files

Merge pull request #632 from pitr-ch/master

preparing 1.0.5
  • Loading branch information...
pitr-ch committed Feb 26, 2017
2 parents 467f3e4 + d4ca5b6 commit 48ff0e21b5a46821ebf264401163f7b78d453640
Showing with 948 additions and 404 deletions.
  1. +2 −9 .travis.yml
  2. +17 −1 CHANGELOG.md
  3. +5 −6 Gemfile
  4. +1 −1 doc/actor/define.out.rb
  5. +3 −3 doc/actor/io.out.rb
  6. +4 −4 doc/actor/messaging.out.rb
  7. +5 −4 doc/actor/quick.out.rb
  8. +9 −9 doc/actor/supervision_tree.out.rb
  9. +160 −73 doc/promises.in.md
  10. +261 −162 doc/promises.out.md
  11. +17 −11 examples/benchmark_new_futures.rb
  12. +68 −20 ext/com/concurrent_ruby/ext/SynchronizationLibrary.java
  13. +2 −0 lib/concurrent-edge.rb
  14. +3 −1 lib/concurrent/actor/behaviour/termination.rb
  15. +6 −0 lib/concurrent/atomic/atomic_boolean.rb
  16. +3 −1 lib/concurrent/atomic/atomic_fixnum.rb
  17. +2 −0 lib/concurrent/atomic/atomic_reference.rb
  18. +0 −4 lib/concurrent/edge.rb
  19. +2 −3 lib/concurrent/edge/atomic_markable_reference.rb
  20. +4 −3 lib/concurrent/edge/cancellation.rb
  21. +1 −0 lib/concurrent/edge/lock_free_queue.rb
  22. +4 −0 lib/concurrent/edge/lock_free_stack.rb
  23. +161 −0 lib/concurrent/edge/processing_actor.rb
  24. +33 −22 lib/concurrent/edge/promises.rb
  25. +7 −0 lib/concurrent/edge/throttle.rb
  26. +3 −0 lib/concurrent/synchronization/condition.rb
  27. +1 −0 lib/concurrent/synchronization/lock.rb
  28. +1 −0 lib/concurrent/synchronization/object.rb
  29. +2 −2 lib/concurrent/version.rb
  30. +8 −0 spec/concurrent/atomic/atomic_boolean_spec.rb
  31. +9 −0 spec/concurrent/atomic/atomic_fixnum_spec.rb
  32. +8 −0 spec/concurrent/atomic/atomic_reference_spec.rb
  33. +68 −0 spec/concurrent/edge/promises_spec.rb
  34. +56 −26 support/release.sh
  35. +0 −26 support/test-truffle.sh
  36. +12 −13 tasks/update_doc.rake
View
@@ -34,24 +34,17 @@ matrix:
- rvm: 2.3.1
jdk: oraclejdk8
env: COVERAGE=1
- rvm: jruby-head
jdk: oraclejdk8
env: TRUFFLE=1
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
- rvm: 1.9.3
- rvm: rbx
- rvm: jruby-head
jdk: oraclejdk8
env: TRUFFLE=1
env:
global:
- JAVA_OPTS=-Xmx1024m
before_install:
- "echo $JAVA_OPTS"
- bundle update # temporary fix, not sure why it helps
- "echo JAVA_OPTS: $JAVA_OPTS"
script: if [[ -v TRUFFLE ]]; then support/test-truffle.sh; else RUBYOPT=-w bundle exec rake ci; fi
script: RUBYOPT=-w bundle exec rake ci
View
@@ -1,4 +1,20 @@
## Current Release v1.0.4 (27 Dec 2016)
## Release v1.0.5, edge v0.3.1 (1 Feb 2017)
concurrent-ruby:
* Documentation for Event and Semaphore
* Use Unsafe#fullFence and #loadFence directly since the shortcuts were removed in JRuby
* Do not depend on org.jruby.util.unsafe.UnsafeHolder
concurrent-ruby-edge:
* (#620) Actors on Pool raise an error
* (#624) Delayed promises did not interact correctly with flatting
* Fix arguments yielded by callback methods
* Overridable default executor in promises factory methods
* Asking actor to terminate will always resolve to `true`
## Release v1.0.4, edge v0.3.0 (27 Dec 2016)
concurrent-ruby:
View
11 Gemfile
@@ -1,10 +1,11 @@
source 'https://rubygems.org'
gemspec name: 'concurrent-ruby'
gemspec name: 'concurrent-ruby-edge'
gem 'concurrent-ruby', path: '.'
gem 'concurrent-ruby-edge', path: '.'
gem 'concurrent-ruby-ext', path: '.', platform: :mri
group :development do
gem 'rake', '~> 10.0'
gem 'rake', '~> 11.0'
gem 'rake-compiler', '~> 0.9.5'
gem 'rake-compiler-dock', '~> 0.4.3'
gem 'gem-compiler', '~> 0.3.0'
@@ -13,11 +14,9 @@ group :development do
# documentation
gem 'countloc', '~> 0.4.0', :platforms => :mri, :require => false
gem 'yard', '~> 0.8.0', :require => false
# TODO (pitr-ch 15-Oct-2016): does not work on 1.9.3 anymore
# TODO remove, reports private classes as undocumented
gem 'inch', '~> 0.7.0', :platforms => :mri, :require => false
gem 'redcarpet', '~> 3.3', platforms: :mri # understands github markdown
gem 'md-ruby-eval'
gem 'pry' # needed by md-ruby-eval
end
group :testing do
View
@@ -33,5 +33,5 @@ def on_event(event)
an_actor << :boo << Message.new(:add, 1)
an_actor.ask!(Message.new(:value, nil)) # => 1
an_actor << :terminate!
# => #<Concurrent::Actor::Reference:0x7ff3ab16edc8 /an_actor (AnActor)>
# => #<Concurrent::Actor::Reference:0x7fbedc137688 /an_actor (AnActor)>
View
@@ -16,7 +16,7 @@ def default_executor
end
actor_doing_io = ActorDoingIO.spawn :actor_doing_io
# => #<Concurrent::Actor::Reference:0x7ff3ab176b40 /actor_doing_io (ActorDoingIO)>
# => #<Concurrent::Actor::Reference:0x7fbedc146e80 /actor_doing_io (ActorDoingIO)>
actor_doing_io.executor == Concurrent.global_io_executor
# => true
@@ -37,10 +37,10 @@ def default_executor
pool = Concurrent::Actor::Utils::Pool.spawn('pool', 2) do |index|
IOWorker.spawn(name: "worker-#{index}")
end
# => #<Concurrent::Actor::Reference:0x7ff3abaac5c0 /pool (Concurrent::Actor::Utils::Pool)>
# => #<Concurrent::Actor::Reference:0x7fbedba83378 /pool (Concurrent::Actor::Utils::Pool)>
pool << 1 << 2 << 3 << 4 << 5 << 6
# => #<Concurrent::Actor::Reference:0x7ff3abaac5c0 /pool (Concurrent::Actor::Utils::Pool)>
# => #<Concurrent::Actor::Reference:0x7fbedba83378 /pool (Concurrent::Actor::Utils::Pool)>
# prints two lines each second
# /pool/worker-0 second:1414677666 message:1
@@ -24,13 +24,13 @@ def on_message(message)
end
calculator = Calculator.spawn('calculator')
# => #<Concurrent::Actor::Reference:0x7ff3ab0c4f80 /calculator (Calculator)>
# => #<Concurrent::Actor::Reference:0x7fbedba52d90 /calculator (Calculator)>
addition = calculator.ask Add[1, 2]
# => <#Concurrent::Edge::Future:0x7ff3ab08e188 pending blocks:[]>
# => <#Concurrent::Promises::Future:0x7fbedc05f7b0 pending>
substraction = calculator.ask Subtract[1, 0.5]
# => <#Concurrent::Edge::Future:0x7ff3ab9de940 pending blocks:[]>
# => <#Concurrent::Promises::Future:0x7fbedd891388 pending>
results = (addition & substraction)
# => <#Concurrent::Edge::Future:0x7ff3aa0b1b48 pending blocks:[]>
# => <#Concurrent::Promises::Future:0x7fbedc04eeb0 pending>
results.value! # => [3, 0.5]
calculator.ask! :terminate! # => true
View
@@ -17,17 +17,18 @@ def on_message(message)
# `link: true` makes the actor linked to root actor and supervised
# which is default behavior
adder = Adder.spawn(name: :adder, link: true, args: [1])
# => #<Concurrent::Actor::Reference:0x7ff3ababf828 /adder (Adder)>
# => #<Concurrent::Actor::Reference:0x7fbedd8e3d40 /adder (Adder)>
adder.parent
# => #<Concurrent::Actor::Reference:0x7ff3abad7ba8 / (Concurrent::Actor::Root)>
# => #<Concurrent::Actor::Reference:0x7fbedbaa1e90 / (Concurrent::Actor::Root)>
# tell and forget
adder.tell(:add).tell(:add)
# => #<Concurrent::Actor::Reference:0x7ff3ababf828 /adder (Adder)>
# => #<Concurrent::Actor::Reference:0x7fbedd8e3d40 /adder (Adder)>
# ask to get result
adder.ask!(:add) # => 4
# fail the actor
adder.ask!(:bad) rescue $! # => #<Concurrent::Actor::UnknownMessage: :bad>
adder.ask!(:bad) rescue $!
# => #<Concurrent::Actor::UnknownMessage: :bad from #<Thread:0x007fbedb8809b8>>
# actor is restarted with initial values
adder.ask!(:add) # => 2
adder.ask!(:terminate!) # => true
@@ -48,26 +48,26 @@ def on_message(msg)
end
master = Master.spawn(name: 'master', supervise: true)
# => #<Concurrent::Actor::Reference:0x7fa595899fa8 /master (Master)>
# => #<Concurrent::Actor::Reference:0x7fbedc05e5e0 /master (Master)>
listener = master.ask!(:listener)
# => #<Concurrent::Actor::Reference:0x7fa5958909d0 /master/listener1 (Listener)>
listener.ask!(:number) # => 12
# => #<Concurrent::Actor::Reference:0x7fbedd86b840 /master/listener1 (Listener)>
listener.ask!(:number) # => 39
# crash the listener which is supervised by master, it's restarted automatically reporting a different number
listener.tell(:crash)
# => #<Concurrent::Actor::Reference:0x7fa5958909d0 /master/listener1 (Listener)>
listener.ask!(:number) # => 65
# => #<Concurrent::Actor::Reference:0x7fbedd86b840 /master/listener1 (Listener)>
listener.ask!(:number) # => 73
master << :crash
# => #<Concurrent::Actor::Reference:0x7fa595899fa8 /master (Master)>
# => #<Concurrent::Actor::Reference:0x7fbedc05e5e0 /master (Master)>
sleep 0.1 # => 0
# ask for listener again, old one is terminated with master and replaced with new one
listener.ask!(:terminated?) # => true
listener = master.ask!(:listener)
# => #<Concurrent::Actor::Reference:0x7fa5970d5608 /master/listener1 (Listener)>
listener.ask!(:number) # => 77
# => #<Concurrent::Actor::Reference:0x7fbedb929090 /master/listener1 (Listener)>
listener.ask!(:number) # => 72
master.ask!(:terminate!) # => [[true], true]
master.ask!(:terminate!) # => true
sleep 0.1 # => 0
Oops, something went wrong.

0 comments on commit 48ff0e2

Please sign in to comment.