Skip to content

Commit

Permalink
Merge pull request #632 from pitr-ch/master
Browse files Browse the repository at this point in the history
preparing 1.0.5
  • Loading branch information
Petr Chalupa authored Feb 26, 2017
2 parents 467f3e4 + d4ca5b6 commit 48ff0e2
Show file tree
Hide file tree
Showing 36 changed files with 948 additions and 404 deletions.
11 changes: 2 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
11 changes: 5 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/actor/define.out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)>

6 changes: 3 additions & 3 deletions doc/actor/io.out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions doc/actor/messaging.out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions doc/actor/quick.out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 9 additions & 9 deletions doc/actor/supervision_tree.out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit 48ff0e2

Please sign in to comment.