Skip to content

Commit 4e221ae

Browse files
committed
Merge branch 'ISSUE-839' of github.com:fzakaria/concurrent-ruby into ISSUE-839
2 parents b50d44f + 5f8d546 commit 4e221ae

File tree

362 files changed

+4283
-3494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

362 files changed

+4283
-3494
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
/spec/examples.txt
2929

3030
# Compiled files
31-
/lib/concurrent/concurrent_ruby.jar
32-
/lib/concurrent/**/concurrent_ruby_ext.*
33-
/lib/concurrent/concurrent_ruby_ext.*
31+
/lib/concurrent-ruby/concurrent/concurrent_ruby.jar
32+
/lib/concurrent-ruby/concurrent/**/concurrent_ruby_ext.*
33+
/lib/concurrent-ruby/concurrent/concurrent_ruby_ext.*

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,16 @@ matrix:
6363

6464
allow_failures:
6565
- rvm: ruby-head
66-
- rvm: jruby-head
6766
- rvm: rbx-3
6867
- name: TruffleRuby Latest
6968
- name: YARD uptodate in docs
69+
- name: JRuby 9.2.9.0 Latest on Java 11
7070

7171
env:
7272
global:
7373
- JAVA_OPTS=-Xmx1024m
7474
- RUBYOPT=-w
75+
- JRUBY_OPTS=--dev
7576

7677
before_install:
7778
- gem install bundler --version 1.17.3

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source 'https://rubygems.org'
22

3-
require File.join(File.dirname(__FILE__), 'lib/concurrent/version')
4-
require File.join(File.dirname(__FILE__ ), 'lib-edge/concurrent/edge/version')
3+
require File.join(File.dirname(__FILE__), 'lib/concurrent-ruby/concurrent/version')
4+
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby-edge/concurrent/edge/version')
55

66
no_path = ENV['NO_PATH']
77
options = no_path ? {} : { path: '.' }

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m
253253
* [ErlangActor](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ErlangActor.html)
254254
Actor implementation which precisely matches Erlang actor behaviour.
255255
Requires at least Ruby 2.1 otherwise it's not loaded.
256+
* [WrappingExecutor](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/WrappingExecutor.html)
257+
A delegating executor which modifies each task before the task is given to
258+
the target executor it delegates to.
256259

257260
## Supported Ruby versions
258261

Rakefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
require_relative 'lib/concurrent/version'
2-
require_relative 'lib-edge/concurrent/edge/version'
3-
require_relative 'lib/concurrent/utility/engine'
1+
require_relative 'lib/concurrent-ruby/concurrent/version'
2+
require_relative 'lib/concurrent-ruby-edge/concurrent/edge/version'
3+
require_relative 'lib/concurrent-ruby/concurrent/utility/engine'
44

55
if Concurrent.ruby_version :<, 2, 0, 0
66
# @!visibility private
@@ -19,15 +19,15 @@ require 'rake/javaextensiontask'
1919

2020
Rake::JavaExtensionTask.new('concurrent_ruby', core_gemspec) do |ext|
2121
ext.ext_dir = 'ext/concurrent-ruby'
22-
ext.lib_dir = 'lib/concurrent'
22+
ext.lib_dir = 'lib/concurrent-ruby/concurrent'
2323
end
2424

2525
unless Concurrent.on_jruby?
2626
require 'rake/extensiontask'
2727

2828
Rake::ExtensionTask.new('concurrent_ruby_ext', ext_gemspec) do |ext|
2929
ext.ext_dir = 'ext/concurrent-ruby-ext'
30-
ext.lib_dir = 'lib/concurrent'
30+
ext.lib_dir = 'lib/concurrent-ruby/concurrent'
3131
ext.source_pattern = '*.{c,h}'
3232

3333
ext.cross_compile = true
@@ -44,7 +44,7 @@ namespace :repackage do
4444
sh 'bundle package'
4545

4646
# build only the jar file not the whole gem for java platform, the jar is part the concurrent-ruby-x.y.z.gem
47-
Rake::Task['lib/concurrent/concurrent_ruby.jar'].invoke
47+
Rake::Task['lib/concurrent-ruby/concurrent/concurrent_ruby.jar'].invoke
4848

4949
# build all gem files
5050
RakeCompilerDock.sh 'bundle install --local && bundle exec rake cross native package --trace'
@@ -59,7 +59,8 @@ Gem::PackageTask.new(core_gemspec) {} if core_gemspec
5959
Gem::PackageTask.new(ext_gemspec) {} if ext_gemspec && !Concurrent.on_jruby?
6060
Gem::PackageTask.new(edge_gemspec) {} if edge_gemspec
6161

62-
CLEAN.include('lib/concurrent/2.*', 'lib/concurrent/*.jar')
62+
CLEAN.include('lib/concurrent-ruby/concurrent/2.*', 'lib/concurrent-ruby/concurrent/*.jar')
63+
6364

6465

6566
begin
@@ -174,8 +175,8 @@ begin
174175
'--output-dir', output_dir,
175176
'--main', 'tmp/README.md',
176177
*common_yard_options)
177-
yard.files = ['./lib/**/*.rb',
178-
'./lib-edge/**/*.rb',
178+
yard.files = ['./lib/concurrent-ruby/**/*.rb',
179+
'./lib/concurrent-ruby-edge/**/*.rb',
179180
'./ext/concurrent_ruby_ext/**/*.c',
180181
'-',
181182
'docs-source/thread_pools.md',

concurrent-ruby-edge.gemspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
require File.join(File.dirname(__FILE__ ), 'lib-edge/concurrent/edge/version')
1+
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby/concurrent/version')
2+
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby-edge/concurrent/edge/version')
23

34
Gem::Specification.new do |s|
45
git_files = `git ls-files`.split("\n")
@@ -12,9 +13,9 @@ Gem::Specification.new do |s|
1213
s.summary = 'Edge features and additions to the concurrent-ruby gem.'
1314
s.license = 'MIT'
1415
s.date = Time.now.strftime('%Y-%m-%d')
15-
s.files = Dir['lib-edge/**/*.rb'] & git_files
16+
s.files = Dir['lib/concurrent-ruby-edge/**/*.rb'] & git_files
1617
s.extra_rdoc_files = Dir['README*', 'LICENSE*', 'CHANGELOG*']
17-
s.require_paths = ['lib-edge']
18+
s.require_paths = ['lib/concurrent-ruby-edge']
1819
s.description = <<-TXT
1920
These features are under active development and may change frequently. They are expected not to
2021
keep backward compatibility (there may also lack tests and documentation). Semantic versions will

concurrent-ruby-ext.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.join(File.dirname(__FILE__ ), 'lib/concurrent/version')
1+
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby/concurrent/version')
22

33
Gem::Specification.new do |s|
44
s.name = 'concurrent-ruby-ext'

concurrent-ruby.gemspec

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
require File.join(File.dirname(__FILE__ ), 'lib/concurrent/version')
2-
require File.join(File.dirname(__FILE__ ), 'lib/concurrent/utility/engine')
1+
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby/concurrent/version')
2+
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby/concurrent/utility/engine')
33

44
Gem::Specification.new do |s|
55
git_files = `git ls-files`.split("\n")
@@ -13,13 +13,14 @@ Gem::Specification.new do |s|
1313
s.summary = 'Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell, F#, C#, Java, and classic concurrency patterns.'
1414
s.license = 'MIT'
1515
s.date = Time.now.strftime('%Y-%m-%d')
16-
s.files = [*Dir['lib/**/*.rb'] & git_files,
16+
s.files = [*Dir['lib/concurrent-ruby/**/*.rb'] & git_files,
1717
*Dir['ext/concurrent-ruby/**/*'] & git_files,
18-
'Rakefile', 'Gemfile',
19-
'lib/concurrent/concurrent_ruby.jar'
18+
'Rakefile',
19+
'Gemfile',
20+
'lib/concurrent-ruby/concurrent/concurrent_ruby.jar'
2021
]
2122
s.extra_rdoc_files = Dir['README*', 'LICENSE*', 'CHANGELOG*']
22-
s.require_paths = ['lib']
23+
s.require_paths = ['lib/concurrent-ruby']
2324
s.description = <<-TXT.gsub(/^ +/, '')
2425
Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.
2526
Inspired by Erlang, Clojure, Go, JavaScript, actors, and classic concurrency patterns.

docs-source/channel.out.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ threads = Array.new(3) { |i| Thread.new { ch.push message: i } }
1616
sleep 0.01 # let the threads run
1717
threads
1818
# => [#<Thread:0x000003@channel.in.md:14 dead>,
19-
# #<Thread:0x000004@channel.in.md:14 dead>,
20-
# #<Thread:0x000005@channel.in.md:14 sleep_forever>]
19+
# #<Thread:0x000004@channel.in.md:14 sleep_forever>,
20+
# #<Thread:0x000005@channel.in.md:14 dead>]
2121
```
2222

2323
When message is popped the last thread continues and finishes as well.
@@ -45,7 +45,7 @@ threads
4545
ch.push message: 3
4646
# => #<Concurrent::Promises::Channel:0x000002 capacity taken 0 of 2>
4747
threads.map(&:value)
48-
# => [{:message=>1}, {:message=>2}, {:message=>3}]
48+
# => [{:message=>2}, {:message=>1}, {:message=>3}]
4949
```
5050

5151
### Promises integration
@@ -210,11 +210,11 @@ log
210210
# "producer 0 pushing 3",
211211
# "producer 1 pushing 1",
212212
# "producer 1 pushing 2",
213-
# "consumer 0 got 1. payload 3 from producer 0",
214-
# "consumer 1 got 1. payload 1 from producer 1",
215-
# "consumer 3 got 1. payload 2 from producer 1",
213+
# "consumer 1 got 1. payload 3 from producer 0",
216214
# "producer 1 pushing 3",
217-
# "consumer 2 got 1. payload 3 from producer 1"]
215+
# "consumer 0 got 1. payload 1 from producer 1",
216+
# "consumer 2 got 1. payload 2 from producer 1",
217+
# "consumer 3 got 1. payload 3 from producer 1"]
218218
```
219219

220220
The producers are much faster than consumers
@@ -279,9 +279,9 @@ log
279279
# "producer 1 pushing 2",
280280
# "producer 0 pushing 3",
281281
# "producer 1 pushing 3",
282-
# "consumer 0 got 1. payload 2 from producer 0",
282+
# "consumer 1 got 1. payload 2 from producer 0",
283283
# "consumer 2 got 1. payload 2 from producer 1",
284-
# "consumer 1 got 1. payload 3 from producer 0",
284+
# "consumer 0 got 1. payload 3 from producer 0",
285285
# "consumer 3 got 1. payload 3 from producer 1"]
286286
```
287287

docs-source/erlang_actor.out.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Although, `Promises.future { 1 + 1 }` is better suited for that purpose.
55

66
```ruby
77
actor = Concurrent::ErlangActor.spawn(type: :on_thread, name: 'addition') { 1 + 1 }
8-
# => #<Concurrent::ErlangActor::Pid:0x000002 addition terminated normally with 2>
8+
# => #<Concurrent::ErlangActor::Pid:0x000002 addition running>
99
actor.terminated.value! # => 2
1010
```
1111

0 commit comments

Comments
 (0)