concurrent-ruby 1.0.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +115 -0
- data/Gemfile +42 -0
- data/{LICENSE.txt → LICENSE.md} +2 -0
- data/README.md +242 -105
- data/Rakefile +332 -0
- data/ext/concurrent-ruby/ConcurrentRubyService.java +17 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/AtomicReferenceLibrary.java +175 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/JRubyMapBackendLibrary.java +248 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaAtomicBooleanLibrary.java +93 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaAtomicFixnumLibrary.java +113 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaSemaphoreLibrary.java +159 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/SynchronizationLibrary.java +307 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMap.java +31 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMapV8.java +3863 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/LongAdder.java +203 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/Striped64.java +342 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/ConcurrentHashMapV8.java +3800 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/LongAdder.java +204 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/Striped64.java +291 -0
- data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166y/ThreadLocalRandom.java +199 -0
- data/lib/concurrent-ruby/concurrent-ruby.rb +1 -0
- data/lib/{concurrent.rb → concurrent-ruby/concurrent.rb} +24 -20
- data/lib/{concurrent → concurrent-ruby/concurrent}/agent.rb +7 -7
- data/lib/concurrent-ruby/concurrent/array.rb +66 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/async.rb +18 -4
- data/lib/{concurrent → concurrent-ruby/concurrent}/atom.rb +10 -10
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/abstract_thread_local_var.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_boolean.rb +26 -22
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_fixnum.rb +27 -23
- data/lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb +164 -0
- data/lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb +204 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/count_down_latch.rb +7 -7
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/cyclic_barrier.rb +1 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/event.rb +1 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/java_count_down_latch.rb +9 -6
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/java_thread_local_var.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_atomic_boolean.rb +2 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_atomic_fixnum.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_count_down_latch.rb +1 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_semaphore.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/read_write_lock.rb +2 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/reentrant_read_write_lock.rb +3 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/ruby_thread_local_var.rb +43 -33
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/semaphore.rb +8 -8
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/thread_local_var.rb +8 -8
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic_reference/mutex_atomic.rb +3 -8
- data/lib/{concurrent → concurrent-ruby/concurrent}/atomic_reference/numeric_cas_wrapper.rb +1 -1
- data/lib/concurrent-ruby/concurrent/atomics.rb +10 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/collection/copy_on_notify_observer_set.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/collection/copy_on_write_observer_set.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/collection/java_non_concurrent_priority_queue.rb +0 -0
- data/lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb +158 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/atomic_reference_map_backend.rb +3 -3
- data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/mri_map_backend.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/non_concurrent_map_backend.rb +1 -2
- data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/synchronized_map_backend.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/collection/non_concurrent_priority_queue.rb +30 -30
- data/lib/{concurrent → concurrent-ruby/concurrent}/collection/ruby_non_concurrent_priority_queue.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/concern/deprecation.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/concern/dereferenceable.rb +3 -3
- data/lib/{concurrent → concurrent-ruby/concurrent}/concern/logging.rb +6 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/concern/obligation.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/concern/observable.rb +7 -7
- data/lib/concurrent-ruby/concurrent/concurrent_ruby.jar +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/configuration.rb +15 -15
- data/lib/{concurrent → concurrent-ruby/concurrent}/constants.rb +1 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/dataflow.rb +2 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/delay.rb +9 -7
- data/lib/{concurrent → concurrent-ruby/concurrent}/errors.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/exchanger.rb +21 -25
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/abstract_executor_service.rb +19 -25
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/cached_thread_pool.rb +5 -5
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/executor_service.rb +17 -17
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/fixed_thread_pool.rb +27 -30
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/immediate_executor.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/indirect_immediate_executor.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/java_executor_service.rb +19 -16
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/java_single_thread_executor.rb +4 -3
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/java_thread_pool_executor.rb +12 -8
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/ruby_executor_service.rb +0 -2
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/ruby_single_thread_executor.rb +0 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/ruby_thread_pool_executor.rb +9 -4
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/safe_task_executor.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/serial_executor_service.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/serialized_execution.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/serialized_execution_delegator.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/simple_executor_service.rb +1 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/single_thread_executor.rb +3 -2
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/thread_pool_executor.rb +6 -6
- data/lib/{concurrent → concurrent-ruby/concurrent}/executor/timer_set.rb +14 -17
- data/lib/{concurrent → concurrent-ruby/concurrent}/executors.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/future.rb +4 -1
- data/lib/concurrent-ruby/concurrent/hash.rb +59 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/immutable_struct.rb +8 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/ivar.rb +5 -6
- data/lib/concurrent-ruby/concurrent/map.rb +337 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/maybe.rb +1 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/mutable_struct.rb +25 -14
- data/lib/{concurrent → concurrent-ruby/concurrent}/mvar.rb +2 -2
- data/lib/{concurrent → concurrent-ruby/concurrent}/options.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/promise.rb +53 -21
- data/lib/concurrent-ruby/concurrent/promises.rb +2167 -0
- data/lib/concurrent-ruby/concurrent/re_include.rb +58 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/scheduled_task.rb +0 -0
- data/lib/concurrent-ruby/concurrent/set.rb +66 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/settable_struct.rb +11 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization.rb +4 -5
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/abstract_lockable_object.rb +5 -5
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/abstract_object.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/abstract_struct.rb +18 -4
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/condition.rb +2 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/jruby_lockable_object.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/jruby_object.rb +1 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/lock.rb +2 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/lockable_object.rb +6 -6
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/mri_object.rb +1 -0
- data/lib/{concurrent/synchronization/mri_lockable_object.rb → concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb} +19 -14
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/object.rb +53 -23
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/rbx_lockable_object.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/rbx_object.rb +1 -0
- data/lib/concurrent-ruby/concurrent/synchronization/truffleruby_object.rb +47 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/volatile.rb +11 -9
- data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/synchronized_delegator.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/adder.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/cheap_lockable.rb +0 -0
- data/lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb +63 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/power_of_two_tuple.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/striped64.rb +9 -4
- data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/volatile.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/xor_shift_random.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/timer_task.rb +5 -2
- data/lib/{concurrent → concurrent-ruby/concurrent}/tuple.rb +1 -1
- data/lib/{concurrent → concurrent-ruby/concurrent}/tvar.rb +2 -2
- data/lib/{concurrent → concurrent-ruby/concurrent}/utility/engine.rb +4 -4
- data/lib/{concurrent → concurrent-ruby/concurrent}/utility/monotonic_time.rb +3 -3
- data/lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb +79 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/utility/native_integer.rb +0 -0
- data/lib/{concurrent → concurrent-ruby/concurrent}/utility/processor_counter.rb +5 -2
- data/lib/concurrent-ruby/concurrent/version.rb +3 -0
- metadata +146 -131
- data/lib/concurrent/array.rb +0 -39
- data/lib/concurrent/atomic/atomic_reference.rb +0 -51
- data/lib/concurrent/atomic_reference/concurrent_update_error.rb +0 -8
- data/lib/concurrent/atomic_reference/direct_update.rb +0 -81
- data/lib/concurrent/atomic_reference/jruby+truffle.rb +0 -2
- data/lib/concurrent/atomic_reference/jruby.rb +0 -16
- data/lib/concurrent/atomic_reference/rbx.rb +0 -22
- data/lib/concurrent/atomic_reference/ruby.rb +0 -32
- data/lib/concurrent/atomics.rb +0 -53
- data/lib/concurrent/edge.rb +0 -26
- data/lib/concurrent/hash.rb +0 -36
- data/lib/concurrent/lazy_register.rb +0 -81
- data/lib/concurrent/map.rb +0 -240
- data/lib/concurrent/synchronization/truffle_lockable_object.rb +0 -9
- data/lib/concurrent/synchronization/truffle_object.rb +0 -31
- data/lib/concurrent/thread_safe/util/array_hash_rbx.rb +0 -30
- data/lib/concurrent/utility/at_exit.rb +0 -97
- data/lib/concurrent/utility/native_extension_loader.rb +0 -73
- data/lib/concurrent/version.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 649de1a5e5c7c82652bd6ad21496f2c1061d7c75517271d8ca30c3ceb9c49038
|
4
|
+
data.tar.gz: 6274d2cd2dcda660a1e34436547eca26d6c74d03e9a527d7ce5d1a9f3f72f4be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2adbf28bdf7034295709496964e8e70d22f59bf058bf18ca005c2ce536627160538de6c510ea1f39893de0ad90b2fb50d6f35c848c97f58bd8f71ff8d9e57fc2
|
7
|
+
data.tar.gz: 1cbc384488e0f70d19d742e54c34dbd7abfaffe89f75230b2f5b80d2ae4d161b731666ce6b64e8f5adeb561b6d32191ce6bd679e05d6bd9eec91b869ee379b2f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,118 @@
|
|
1
|
+
## Current
|
2
|
+
|
3
|
+
## Release v1.1.6, edge v0.6.0 (10 Feb 2020)
|
4
|
+
|
5
|
+
concurrent-ruby:
|
6
|
+
|
7
|
+
* (#841) Concurrent.disable_at_exit_handlers! is no longer needed and was deprecated.
|
8
|
+
* (#841) AbstractExecutorService#auto_terminate= was deprecated and has no effect.
|
9
|
+
Set :auto_terminate option instead when executor is initialized.
|
10
|
+
|
11
|
+
## Release v1.1.6.pre1, edge v0.6.0.pre1 (26 Jan 2020)
|
12
|
+
|
13
|
+
concurrent-ruby:
|
14
|
+
|
15
|
+
* (#828) Allow to name executors, the name is also used to name their threads
|
16
|
+
* (#838) Implement #dup and #clone for structs
|
17
|
+
* (#821) Safer finalizers for thread local variables
|
18
|
+
* Documentation fixes
|
19
|
+
* (#814) Use Ruby's Etc.nprocessors if available
|
20
|
+
* (#812) Fix directory structure not to mess with packaging tools
|
21
|
+
* (#840) Fix termination of pools on JRuby
|
22
|
+
|
23
|
+
concurrent-ruby-edge:
|
24
|
+
|
25
|
+
* Add WrappingExecutor (#830)
|
26
|
+
|
27
|
+
## Release v1.1.5, edge v0.5.0 (10 Mar 2019)
|
28
|
+
|
29
|
+
concurrent-ruby:
|
30
|
+
|
31
|
+
* fix potential leak of context on JRuby and Java 7
|
32
|
+
|
33
|
+
concurrent-ruby-edge:
|
34
|
+
|
35
|
+
* Add finalized Concurrent::Cancellation
|
36
|
+
* Add finalized Concurrent::Throttle
|
37
|
+
* Add finalized Concurrent::Promises::Channel
|
38
|
+
* Add new Concurrent::ErlangActor
|
39
|
+
|
40
|
+
## Release v1.1.4 (14 Dec 2018)
|
41
|
+
|
42
|
+
* (#780) Remove java_alias of 'submit' method of Runnable to let executor service work on java 11
|
43
|
+
* (#776) Fix NameError on defining a struct with a name which is already taken in an ancestor
|
44
|
+
|
45
|
+
## Release v1.1.3 (7 Nov 2018)
|
46
|
+
|
47
|
+
* (#775) fix partial require of the gem (although not officially supported)
|
48
|
+
|
49
|
+
## Release v1.1.2 (6 Nov 2018)
|
50
|
+
|
51
|
+
* (#773) more defensive 1.9.3 support
|
52
|
+
|
53
|
+
## Release v1.1.1, edge v0.4.1 (1 Nov 2018)
|
54
|
+
|
55
|
+
* (#768) add support for 1.9.3 back
|
56
|
+
|
57
|
+
## Release v1.1.0, edge v0.4.0 (31 OCt 2018) (yanked)
|
58
|
+
|
59
|
+
* (#768) yanked because of issues with removed 1.9.3 support
|
60
|
+
|
61
|
+
## Release v1.1.0.pre2, edge v0.4.0.pre2 (18 Sep 2018)
|
62
|
+
|
63
|
+
concurrent-ruby:
|
64
|
+
|
65
|
+
* fixed documentation and README links
|
66
|
+
* fix Set for TruffleRuby and Rubinius
|
67
|
+
* use properly supported TruffleRuby APIs
|
68
|
+
|
69
|
+
concurrent-ruby-edge:
|
70
|
+
|
71
|
+
* add Promises.zip_futures_over_on
|
72
|
+
|
73
|
+
## Release v1.1.0.pre1, edge v0.4.0.pre1 (15 Aug 2018)
|
74
|
+
|
75
|
+
concurrent-ruby:
|
76
|
+
|
77
|
+
* requires at least Ruby 2.0
|
78
|
+
* [Promises](http://ruby-concurrency.github.io/concurrent-ruby/1.1.0/Concurrent/Promises.html)
|
79
|
+
are moved from `concurrent-ruby-edge` to `concurrent-ruby`
|
80
|
+
* Add support for TruffleRuby
|
81
|
+
* (#734) Fix Array/Hash/Set construction broken on TruffleRuby
|
82
|
+
* AtomicReference fixed
|
83
|
+
* CI stabilization
|
84
|
+
* remove sharp dependency edge -> core
|
85
|
+
* remove warnings
|
86
|
+
* documentation updates
|
87
|
+
* Exchanger is no longer documented as edge since it was already available in
|
88
|
+
`concurrent-ruby`
|
89
|
+
* (#644) Fix Map#each and #each_pair not returning enumerator outside of MRI
|
90
|
+
* (#659) Edge promises fail during error handling
|
91
|
+
* (#741) Raise on recursive Delay#value call
|
92
|
+
* (#727) #717 fix global IO executor on JRuby
|
93
|
+
* (#740) Drop support for CRuby 1.9, JRuby 1.7, Rubinius.
|
94
|
+
* (#737) Move AtomicMarkableReference out of Edge
|
95
|
+
* (#708) Prefer platform specific memory barriers
|
96
|
+
* (#735) Fix wrong expected exception in channel spec assertion
|
97
|
+
* (#729) Allow executor option in `Promise#then`
|
98
|
+
* (#725) fix timeout check to use timeout_interval
|
99
|
+
* (#719) update engine detection
|
100
|
+
* (#660) Add specs for Promise#zip/Promise.zip ordering
|
101
|
+
* (#654) Promise.zip execution changes
|
102
|
+
* (#666) Add thread safe set implementation
|
103
|
+
* (#651) #699 #to_s, #inspect should not output negative object IDs.
|
104
|
+
* (#685) Avoid RSpec warnings about raise_error
|
105
|
+
* (#680) Avoid RSpec monkey patching, persist spec results locally, use RSpec
|
106
|
+
v3.7.0
|
107
|
+
* (#665) Initialize the monitor for new subarrays on Rubinius
|
108
|
+
* (#661) Fix error handling in edge promises
|
109
|
+
|
110
|
+
concurrent-ruby-edge:
|
111
|
+
|
112
|
+
* (#659) Edge promises fail during error handling
|
113
|
+
* Edge files clearly separated in `lib-edge`
|
114
|
+
* added ReInclude
|
115
|
+
|
1
116
|
## Release v1.0.5, edge v0.3.1 (26 Feb 2017)
|
2
117
|
|
3
118
|
concurrent-ruby:
|
data/Gemfile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
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')
|
5
|
+
require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby/concurrent/utility/engine')
|
6
|
+
|
7
|
+
no_path = ENV['NO_PATH']
|
8
|
+
options = no_path ? {} : { path: '.' }
|
9
|
+
|
10
|
+
gem 'concurrent-ruby', Concurrent::VERSION, options
|
11
|
+
gem 'concurrent-ruby-edge', Concurrent::EDGE_VERSION, options
|
12
|
+
gem 'concurrent-ruby-ext', Concurrent::VERSION, options.merge(platform: :mri)
|
13
|
+
|
14
|
+
group :development do
|
15
|
+
gem 'rake', (Concurrent.ruby_version :<, 2, 2, 0) ? '~> 12.0' : '~> 13.0'
|
16
|
+
gem 'rake-compiler', '~> 1.0', '>= 1.0.7'
|
17
|
+
gem 'rake-compiler-dock', '~> 0.7.0'
|
18
|
+
gem 'pry', '~> 0.11', platforms: :mri
|
19
|
+
end
|
20
|
+
|
21
|
+
group :documentation, optional: true do
|
22
|
+
gem 'yard', '~> 0.9.0', require: false
|
23
|
+
gem 'redcarpet', '~> 3.0', platforms: :mri # understands github markdown
|
24
|
+
gem 'md-ruby-eval', '~> 0.6'
|
25
|
+
end
|
26
|
+
|
27
|
+
group :testing do
|
28
|
+
gem 'rspec', '~> 3.7'
|
29
|
+
gem 'timecop', '~> 0.7.4'
|
30
|
+
gem 'sigdump', require: false
|
31
|
+
end
|
32
|
+
|
33
|
+
# made opt-in since it will not install on jruby 1.7
|
34
|
+
group :coverage, optional: !ENV['COVERAGE'] do
|
35
|
+
gem 'simplecov', '~> 0.16.0', require: false
|
36
|
+
gem 'coveralls', '~> 0.8.2', require: false
|
37
|
+
end
|
38
|
+
|
39
|
+
group :benchmarks, optional: true do
|
40
|
+
gem 'benchmark-ips', '~> 2.7'
|
41
|
+
gem 'bench9000'
|
42
|
+
end
|
data/{LICENSE.txt → LICENSE.md}
RENAMED
@@ -1,3 +1,4 @@
|
|
1
|
+
```
|
1
2
|
Copyright (c) Jerry D'Antonio -- released under the MIT license.
|
2
3
|
|
3
4
|
http://www.opensource.org/licenses/mit-license.php
|
@@ -19,3 +20,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
20
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
21
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
22
|
THE SOFTWARE.
|
23
|
+
```
|
data/README.md
CHANGED
@@ -3,9 +3,6 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/concurrent-ruby.svg)](http://badge.fury.io/rb/concurrent-ruby)
|
4
4
|
[![Build Status](https://travis-ci.org/ruby-concurrency/concurrent-ruby.svg?branch=master)](https://travis-ci.org/ruby-concurrency/concurrent-ruby)
|
5
5
|
[![Build status](https://ci.appveyor.com/api/projects/status/iq8aboyuu3etad4w?svg=true)](https://ci.appveyor.com/project/rubyconcurrency/concurrent-ruby)
|
6
|
-
[![Code Climate](https://codeclimate.com/github/ruby-concurrency/concurrent-ruby.svg)](https://codeclimate.com/github/ruby-concurrency/concurrent-ruby)
|
7
|
-
[![Inline docs](http://inch-ci.org/github/ruby-concurrency/concurrent-ruby.svg)](http://inch-ci.org/github/ruby-concurrency/concurrent-ruby)
|
8
|
-
[![Dependency Status](https://gemnasium.com/ruby-concurrency/concurrent-ruby.svg)](https://gemnasium.com/ruby-concurrency/concurrent-ruby)
|
9
6
|
[![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
|
10
7
|
[![Gitter chat](https://img.shields.io/badge/IRC%20(gitter)-devs%20%26%20users-brightgreen.svg)](https://gitter.im/ruby-concurrency/concurrent-ruby)
|
11
8
|
|
@@ -19,129 +16,259 @@ Modern concurrency tools for Ruby. Inspired by
|
|
19
16
|
[Java](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/package-summary.html),
|
20
17
|
and classic concurrency patterns.
|
21
18
|
|
22
|
-
<img src="https://raw.githubusercontent.com/ruby-concurrency/concurrent-ruby/master/
|
19
|
+
<img src="https://raw.githubusercontent.com/ruby-concurrency/concurrent-ruby/master/docs-source/logo/concurrent-ruby-logo-300x300.png" align="right" style="margin-left: 20px;" />
|
23
20
|
|
24
21
|
The design goals of this gem are:
|
25
22
|
|
26
|
-
*
|
27
|
-
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
31
|
-
*
|
32
|
-
*
|
33
|
-
*
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
23
|
+
* Be an 'unopinionated' toolbox that provides useful utilities without debating which is better
|
24
|
+
or why
|
25
|
+
* Remain free of external gem dependencies
|
26
|
+
* Stay true to the spirit of the languages providing inspiration
|
27
|
+
* But implement in a way that makes sense for Ruby
|
28
|
+
* Keep the semantics as idiomatic Ruby as possible
|
29
|
+
* Support features that make sense in Ruby
|
30
|
+
* Exclude features that don't make sense in Ruby
|
31
|
+
* Be small, lean, and loosely coupled
|
32
|
+
* Thread-safety
|
33
|
+
* Backward compatibility
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
**This gem depends on
|
38
|
+
[contributions](https://github.com/ruby-concurrency/concurrent-ruby/graphs/contributors) and we
|
39
|
+
appreciate your help. Would you like to contribute? Great! Have a look at
|
40
|
+
[issues with `looking-for-contributor` label](https://github.com/ruby-concurrency/concurrent-ruby/issues?q=is%3Aissue+is%3Aopen+label%3Alooking-for-contributor).** And if you pick something up let us know on the issue.
|
40
41
|
|
41
42
|
## Thread Safety
|
42
43
|
|
43
|
-
*Concurrent Ruby makes the strongest thread safety guarantees of any Ruby concurrency
|
44
|
+
*Concurrent Ruby makes one of the strongest thread safety guarantees of any Ruby concurrency
|
45
|
+
library, providing consistent behavior and guarantees on all four of the main Ruby interpreters
|
46
|
+
(MRI/CRuby, JRuby, Rubinius, TruffleRuby).*
|
47
|
+
|
48
|
+
Every abstraction in this library is thread safe. Specific thread safety guarantees are documented
|
49
|
+
with each abstraction.
|
44
50
|
|
45
|
-
|
51
|
+
It is critical to remember, however, that Ruby is a language of mutable references. *No*
|
52
|
+
concurrency library for Ruby can ever prevent the user from making thread safety mistakes (such as
|
53
|
+
sharing a mutable object between threads and modifying it on both threads) or from creating
|
54
|
+
deadlocks through incorrect use of locks. All the library can do is provide safe abstractions which
|
55
|
+
encourage safe practices. Concurrent Ruby provides more safe concurrency abstractions than any
|
56
|
+
other Ruby library, many of which support the mantra of
|
57
|
+
["Do not communicate by sharing memory; instead, share memory by communicating"](https://blog.golang.org/share-memory-by-communicating).
|
58
|
+
Concurrent Ruby is also the only Ruby library which provides a full suite of thread safe and
|
59
|
+
immutable variable types and data structures.
|
46
60
|
|
47
|
-
|
61
|
+
We've also initiated discussion to document [memory model](docs-source/synchronization.md) of Ruby which
|
62
|
+
would provide consistent behaviour and guarantees on all four of the main Ruby interpreters
|
63
|
+
(MRI/CRuby, JRuby, Rubinius, TruffleRuby).
|
48
64
|
|
49
65
|
## Features & Documentation
|
50
66
|
|
51
|
-
The primary site for documentation is the automatically generated
|
67
|
+
**The primary site for documentation is the automatically generated
|
68
|
+
[API documentation](http://ruby-concurrency.github.io/concurrent-ruby/index.html) which is up to
|
69
|
+
date with latest release.** This readme matches the master so may contain new stuff not yet
|
70
|
+
released.
|
71
|
+
|
72
|
+
We also have a [IRC (gitter)](https://gitter.im/ruby-concurrency/concurrent-ruby).
|
73
|
+
|
74
|
+
### Versioning
|
75
|
+
|
76
|
+
* `concurrent-ruby` uses [Semantic Versioning](http://semver.org/)
|
77
|
+
* `concurrent-ruby-ext` has always same version as `concurrent-ruby`
|
78
|
+
* `concurrent-ruby-edge` will always be 0.y.z therefore following
|
79
|
+
[point 4](http://semver.org/#spec-item-4) applies *"Major version zero
|
80
|
+
(0.y.z) is for initial development. Anything may change at any time. The
|
81
|
+
public API should not be considered stable."* However we additionally use
|
82
|
+
following rules:
|
83
|
+
* Minor version increment means incompatible changes were made
|
84
|
+
* Patch version increment means only compatible changes were made
|
52
85
|
|
53
|
-
We also have a [mailing list](http://groups.google.com/group/concurrent-ruby) and [IRC (gitter)](https://gitter.im/ruby-concurrency/concurrent-ruby).
|
54
86
|
|
55
87
|
#### General-purpose Concurrency Abstractions
|
56
88
|
|
57
|
-
*
|
58
|
-
|
59
|
-
|
60
|
-
*
|
61
|
-
|
62
|
-
*
|
89
|
+
* [Async](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Async.html):
|
90
|
+
A mixin module that provides simple asynchronous behavior to a class. Loosely based on Erlang's
|
91
|
+
[gen_server](http://www.erlang.org/doc/man/gen_server.html).
|
92
|
+
* [ScheduledTask](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ScheduledTask.html):
|
93
|
+
Like a Future scheduled for a specific future time.
|
94
|
+
* [TimerTask](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/TimerTask.html):
|
95
|
+
A Thread that periodically wakes up to perform work at regular intervals.
|
96
|
+
* [Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html):
|
97
|
+
Unified implementation of futures and promises which combines features of previous `Future`,
|
98
|
+
`Promise`, `IVar`, `Event`, `dataflow`, `Delay`, and (partially) `TimerTask` into a single
|
99
|
+
framework. It extensively uses the new synchronization layer to make all the features
|
100
|
+
**non-blocking** and **lock-free**, with the exception of obviously blocking operations like
|
101
|
+
`#wait`, `#value`. It also offers better performance.
|
63
102
|
|
64
103
|
#### Thread-safe Value Objects, Structures, and Collections
|
65
104
|
|
66
105
|
Collection classes that were originally part of the (deprecated) `thread_safe` gem:
|
67
106
|
|
68
|
-
*
|
69
|
-
|
70
|
-
*
|
71
|
-
|
107
|
+
* [Array](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Array.html) A thread-safe
|
108
|
+
subclass of Ruby's standard [Array](http://ruby-doc.org/core-2.2.0/Array.html).
|
109
|
+
* [Hash](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Hash.html) A thread-safe
|
110
|
+
subclass of Ruby's standard [Hash](http://ruby-doc.org/core-2.2.0/Hash.html).
|
111
|
+
* [Set](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Set.html) A thread-safe
|
112
|
+
subclass of Ruby's standard [Set](http://ruby-doc.org/stdlib-2.4.0/libdoc/set/rdoc/Set.html).
|
113
|
+
* [Map](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Map.html) A hash-like object
|
114
|
+
that should have much better performance characteristics, especially under high concurrency,
|
115
|
+
than `Concurrent::Hash`.
|
116
|
+
* [Tuple](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Tuple.html) A fixed size
|
117
|
+
array with volatile (synchronized, thread safe) getters/setters.
|
72
118
|
|
73
119
|
Value objects inspired by other languages:
|
74
120
|
|
75
|
-
*
|
76
|
-
|
77
|
-
|
121
|
+
* [Maybe](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Maybe.html) A thread-safe,
|
122
|
+
immutable object representing an optional value, based on
|
123
|
+
[Haskell Data.Maybe](https://hackage.haskell.org/package/base-4.2.0.1/docs/Data-Maybe.html).
|
78
124
|
|
79
125
|
Structure classes derived from Ruby's [Struct](http://ruby-doc.org/core-2.2.0/Struct.html):
|
80
126
|
|
81
|
-
*
|
82
|
-
|
83
|
-
*
|
127
|
+
* [ImmutableStruct](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ImmutableStruct.html)
|
128
|
+
Immutable struct where values are set at construction and cannot be changed later.
|
129
|
+
* [MutableStruct](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/MutableStruct.html)
|
130
|
+
Synchronized, mutable struct where values can be safely changed at any time.
|
131
|
+
* [SettableStruct](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/SettableStruct.html)
|
132
|
+
Synchronized, write-once struct where values can be set at most once, either at construction
|
133
|
+
or any time thereafter.
|
84
134
|
|
85
135
|
Thread-safe variables:
|
86
136
|
|
87
|
-
*
|
88
|
-
|
89
|
-
|
90
|
-
*
|
91
|
-
|
92
|
-
|
93
|
-
*
|
94
|
-
|
95
|
-
*
|
137
|
+
* [Agent](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Agent.html): A way to
|
138
|
+
manage shared, mutable, *asynchronous*, independent state. Based on Clojure's
|
139
|
+
[Agent](http://clojure.org/agents).
|
140
|
+
* [Atom](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Atom.html): A way to manage
|
141
|
+
shared, mutable, *synchronous*, independent state. Based on Clojure's
|
142
|
+
[Atom](http://clojure.org/atoms).
|
143
|
+
* [AtomicBoolean](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicBoolean.html)
|
144
|
+
A boolean value that can be updated atomically.
|
145
|
+
* [AtomicFixnum](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicFixnum.html)
|
146
|
+
A numeric value that can be updated atomically.
|
147
|
+
* [AtomicReference](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicReference.html)
|
148
|
+
An object reference that may be updated atomically.
|
149
|
+
* [Exchanger](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Exchanger.html)
|
150
|
+
A synchronization point at which threads can pair and swap elements within pairs. Based on
|
151
|
+
Java's [Exchanger](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Exchanger.html).
|
152
|
+
* [MVar](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/MVar.html) A synchronized
|
153
|
+
single element container. Based on Haskell's
|
154
|
+
[MVar](https://hackage.haskell.org/package/base-4.8.1.0/docs/Control-Concurrent-MVar.html) and
|
155
|
+
Scala's [MVar](http://docs.typelevel.org/api/scalaz/nightly/index.html#scalaz.concurrent.MVar$).
|
156
|
+
* [ThreadLocalVar](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ThreadLocalVar.html)
|
157
|
+
A variable where the value is different for each thread.
|
158
|
+
* [TVar](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/TVar.html) A transactional
|
159
|
+
variable implementing software transactional memory (STM). Based on Clojure's
|
160
|
+
[Ref](http://clojure.org/refs).
|
96
161
|
|
97
162
|
#### Java-inspired ThreadPools and Other Executors
|
98
163
|
|
99
|
-
*
|
164
|
+
* See the [thread pool](http://ruby-concurrency.github.io/concurrent-ruby/master/file.thread_pools.html)
|
165
|
+
overview, which also contains a list of other Executors available.
|
100
166
|
|
101
167
|
#### Thread Synchronization Classes and Algorithms
|
102
168
|
|
103
|
-
*
|
104
|
-
|
105
|
-
*
|
106
|
-
|
107
|
-
*
|
108
|
-
|
109
|
-
*
|
110
|
-
|
169
|
+
* [CountDownLatch](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/CountDownLatch.html)
|
170
|
+
A synchronization object that allows one thread to wait on multiple other threads.
|
171
|
+
* [CyclicBarrier](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/CyclicBarrier.html)
|
172
|
+
A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point.
|
173
|
+
* [Event](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Event.html) Old school
|
174
|
+
kernel-style event.
|
175
|
+
* [ReadWriteLock](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ReadWriteLock.html)
|
176
|
+
A lock that supports multiple readers but only one writer.
|
177
|
+
* [ReentrantReadWriteLock](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ReentrantReadWriteLock.html)
|
178
|
+
A read/write lock with reentrant and upgrade features.
|
179
|
+
* [Semaphore](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Semaphore.html)
|
180
|
+
A counting-based locking mechanism that uses permits.
|
181
|
+
* [AtomicMarkableReference](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicMarkableReference.html)
|
182
|
+
|
183
|
+
#### Deprecated
|
184
|
+
|
185
|
+
Deprecated features are still available and bugs are being fixed, but new features will not be added.
|
186
|
+
|
187
|
+
* ~~[Future](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Future.html):
|
188
|
+
An asynchronous operation that produces a value.~~ Replaced by
|
189
|
+
[Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html).
|
190
|
+
* ~~[.dataflow](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent.html#dataflow-class_method):
|
191
|
+
Built on Futures, Dataflow allows you to create a task that will be scheduled when all of
|
192
|
+
its data dependencies are available.~~ Replaced by
|
193
|
+
[Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html).
|
194
|
+
* ~~[Promise](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promise.html): Similar
|
195
|
+
to Futures, with more features.~~ Replaced by
|
196
|
+
[Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html).
|
197
|
+
* ~~[Delay](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Delay.html) Lazy evaluation
|
198
|
+
of a block yielding an immutable result. Based on Clojure's
|
199
|
+
[delay](https://clojuredocs.org/clojure.core/delay).~~ Replaced by
|
200
|
+
[Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html).
|
201
|
+
* ~~[IVar](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/IVar.html) Similar to a
|
202
|
+
"future" but can be manually assigned once, after which it becomes immutable.~~ Replaced by
|
203
|
+
[Promises](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises.html).
|
204
|
+
|
111
205
|
### Edge Features
|
112
206
|
|
113
207
|
These are available in the `concurrent-ruby-edge` companion gem.
|
114
208
|
|
115
209
|
These features are under active development and may change frequently. They are expected not to
|
116
210
|
keep backward compatibility (there may also lack tests and documentation). Semantic versions will
|
117
|
-
be obeyed though. Features developed in `concurrent-ruby-edge` are expected to move to
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
*
|
131
|
-
*
|
132
|
-
*
|
133
|
-
*
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
211
|
+
be obeyed though. Features developed in `concurrent-ruby-edge` are expected to move to
|
212
|
+
`concurrent-ruby` when final.
|
213
|
+
|
214
|
+
* [Actor](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Actor.html): Implements
|
215
|
+
the Actor Model, where concurrent actors exchange messages.
|
216
|
+
*Status: Partial documentation and tests; depends on new future/promise framework; stability is good.*
|
217
|
+
* [Channel](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Channel.html):
|
218
|
+
Communicating Sequential Processes ([CSP](https://en.wikipedia.org/wiki/Communicating_sequential_processes)).
|
219
|
+
Functionally equivalent to Go [channels](https://tour.golang.org/concurrency/2) with additional
|
220
|
+
inspiration from Clojure [core.async](https://clojure.github.io/core.async/).
|
221
|
+
*Status: Partial documentation and tests.*
|
222
|
+
* [LazyRegister](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/LazyRegister.html)
|
223
|
+
* [LockFreeLinkedSet](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Edge/LockFreeLinkedSet.html)
|
224
|
+
*Status: will be moved to core soon.*
|
225
|
+
* [LockFreeStack](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/LockFreeStack.html)
|
226
|
+
*Status: missing documentation and tests.*
|
227
|
+
* [Promises::Channel](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Promises/Channel.html)
|
228
|
+
A first in first out channel that accepts messages with push family of methods and returns
|
229
|
+
messages with pop family of methods.
|
230
|
+
Pop and push operations can be represented as futures, see `#pop_op` and `#push_op`.
|
231
|
+
The capacity of the channel can be limited to support back pressure, use capacity option in `#initialize`.
|
232
|
+
`#pop` method blocks ans `#pop_op` returns pending future if there is no message in the channel.
|
233
|
+
If the capacity is limited the `#push` method blocks and `#push_op` returns pending future.
|
234
|
+
* [Cancellation](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Cancellation.html)
|
235
|
+
The Cancellation abstraction provides cooperative cancellation.
|
236
|
+
|
237
|
+
The standard methods `Thread#raise` of `Thread#kill` available in Ruby
|
238
|
+
are very dangerous (see linked the blog posts bellow).
|
239
|
+
Therefore concurrent-ruby provides an alternative.
|
240
|
+
|
241
|
+
* <https://jvns.ca/blog/2015/11/27/why-rubys-timeout-is-dangerous-and-thread-dot-raise-is-terrifying/>
|
242
|
+
* <http://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/>
|
243
|
+
* <http://blog.headius.com/2008/02/rubys-threadraise-threadkill-timeoutrb.html>
|
244
|
+
|
245
|
+
It provides an object which represents a task which can be executed,
|
246
|
+
the task has to get the reference to the object and periodically cooperatively check that it is not cancelled.
|
247
|
+
Good practices to make tasks cancellable:
|
248
|
+
* check cancellation every cycle of a loop which does significant work,
|
249
|
+
* do all blocking actions in a loop with a timeout then on timeout check cancellation
|
250
|
+
and if ok block again with the timeout
|
251
|
+
* [Throttle](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Throttle.html)
|
252
|
+
A tool managing concurrency level of tasks.
|
253
|
+
* [ErlangActor](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ErlangActor.html)
|
254
|
+
Actor implementation which precisely matches Erlang actor behaviour.
|
255
|
+
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.
|
259
|
+
|
260
|
+
## Supported Ruby versions
|
261
|
+
|
262
|
+
* MRI 2.0 and above
|
263
|
+
* JRuby 9000
|
264
|
+
* TruffleRuby are supported.
|
265
|
+
* Any Ruby interpreter that is compliant with Ruby 2.0 or newer.
|
266
|
+
|
267
|
+
Actually we still support mri 1.9.3 and jruby 1.7.27 but we are looking at ways how to drop the support.
|
268
|
+
Java 8 is preferred for JRuby but every Java version on which JRuby 9000 runs is supported.
|
269
|
+
|
270
|
+
The legacy support for Rubinius is kept but it is no longer maintained, if you would like to help
|
271
|
+
please respond to [#739](https://github.com/ruby-concurrency/concurrent-ruby/issues/739).
|
145
272
|
|
146
273
|
## Usage
|
147
274
|
|
@@ -151,13 +278,16 @@ Everything within this gem can be loaded simply by requiring it:
|
|
151
278
|
require 'concurrent'
|
152
279
|
```
|
153
280
|
|
281
|
+
*Requiring only specific abstractions from Concurrent Ruby is not yet supported.*
|
282
|
+
|
154
283
|
To use the tools in the Edge gem it must be required separately:
|
155
284
|
|
156
285
|
```ruby
|
157
286
|
require 'concurrent-edge'
|
158
287
|
```
|
159
288
|
|
160
|
-
If the library does not behave as expected, `Concurrent.use_stdlib_logger(Logger::DEBUG)` could
|
289
|
+
If the library does not behave as expected, `Concurrent.use_stdlib_logger(Logger::DEBUG)` could
|
290
|
+
help to reveal the problem.
|
161
291
|
|
162
292
|
## Installation
|
163
293
|
|
@@ -193,9 +323,9 @@ and run `bundle install` from your shell.
|
|
193
323
|
### C Extensions for MRI
|
194
324
|
|
195
325
|
Potential performance improvements may be achieved under MRI by installing optional C extensions.
|
196
|
-
To
|
197
|
-
gem. `concurrent-ruby` and `concurrent-ruby-ext` are always released together with same
|
198
|
-
Simply install the extension gem too:
|
326
|
+
To minimise installation errors the C extensions are available in the `concurrent-ruby-ext`
|
327
|
+
extension gem. `concurrent-ruby` and `concurrent-ruby-ext` are always released together with same
|
328
|
+
version. Simply install the extension gem too:
|
199
329
|
|
200
330
|
```ruby
|
201
331
|
gem install concurrent-ruby-ext
|
@@ -220,28 +350,35 @@ and load the appropriate C extensions.
|
|
220
350
|
|
221
351
|
#### Note For gem developers
|
222
352
|
|
223
|
-
No gems should depend on `concurrent-ruby-ext`. Doing so will force C extensions on your users.
|
224
|
-
|
353
|
+
No gems should depend on `concurrent-ruby-ext`. Doing so will force C extensions on your users. The
|
354
|
+
best practice is to depend on `concurrent-ruby` and let users to decide if they want C extensions.
|
225
355
|
|
226
356
|
## Maintainers
|
227
357
|
|
228
|
-
*
|
229
|
-
*
|
230
|
-
*
|
231
|
-
|
232
|
-
|
233
|
-
|
358
|
+
* [Petr Chalupa](https://github.com/pitr-ch) (lead maintainer, point-of-contact)
|
359
|
+
* [Jerry D'Antonio](https://github.com/jdantonio) (creator)
|
360
|
+
* [Chris Seaton](https://github.com/chrisseaton)
|
361
|
+
|
362
|
+
### Special Thanks to
|
363
|
+
|
364
|
+
* [Brian Durand](https://github.com/bdurand) for the `ref` gem
|
365
|
+
* [Charles Oliver Nutter](https://github.com/headius) for the `atomic` and `thread_safe` gems
|
366
|
+
* [thedarkone](https://github.com/thedarkone) for the `thread_safe` gem
|
367
|
+
|
368
|
+
and to the past maintainers
|
234
369
|
|
235
|
-
|
370
|
+
* [Michele Della Torre](https://github.com/mighe)
|
371
|
+
* [Paweł Obrok](https://github.com/obrok)
|
372
|
+
* [Lucas Allan](https://github.com/lucasallan)
|
236
373
|
|
237
|
-
|
238
|
-
|
239
|
-
* [thedarkone](https://github.com/thedarkone) for the `thread_safe` gem
|
374
|
+
and to [Ruby Association](https://www.ruby.or.jp/en/) for sponsoring a project
|
375
|
+
["Enhancing Ruby’s concurrency tooling"](https://www.ruby.or.jp/en/news/20181106) in 2018.
|
240
376
|
|
241
377
|
## License and Copyright
|
242
378
|
|
243
|
-
*Concurrent Ruby* is free software released under the
|
379
|
+
*Concurrent Ruby* is free software released under the
|
380
|
+
[MIT License](http://www.opensource.org/licenses/MIT).
|
244
381
|
|
245
|
-
The *Concurrent Ruby* [logo](https://
|
246
|
-
|
247
|
-
|
382
|
+
The *Concurrent Ruby* [logo](https://raw.githubusercontent.com/ruby-concurrency/concurrent-ruby/master/docs-source/logo/concurrent-ruby-logo-300x300.png) was
|
383
|
+
designed by [David Jones](https://twitter.com/zombyboy). It is Copyright © 2014
|
384
|
+
[Jerry D'Antonio](https://twitter.com/jerrydantonio). All Rights Reserved.
|