concurrent-ruby 1.1.4 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -0
  3. data/Gemfile +11 -8
  4. data/{LICENSE.md → LICENSE.txt} +18 -20
  5. data/README.md +40 -5
  6. data/Rakefile +52 -64
  7. data/ext/concurrent-ruby/com/concurrent_ruby/ext/SynchronizationLibrary.java +9 -8
  8. data/lib/{concurrent-ruby.rb → concurrent-ruby/concurrent-ruby.rb} +0 -0
  9. data/lib/{concurrent.rb → concurrent-ruby/concurrent.rb} +0 -0
  10. data/lib/{concurrent → concurrent-ruby/concurrent}/agent.rb +0 -0
  11. data/lib/{concurrent → concurrent-ruby/concurrent}/array.rb +9 -9
  12. data/lib/{concurrent → concurrent-ruby/concurrent}/async.rb +23 -20
  13. data/lib/{concurrent → concurrent-ruby/concurrent}/atom.rb +1 -1
  14. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/abstract_thread_local_var.rb +0 -0
  15. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_boolean.rb +2 -2
  16. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_fixnum.rb +2 -2
  17. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_markable_reference.rb +0 -0
  18. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_reference.rb +0 -0
  19. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/count_down_latch.rb +1 -1
  20. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/cyclic_barrier.rb +0 -0
  21. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/event.rb +0 -0
  22. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/java_count_down_latch.rb +0 -0
  23. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/java_thread_local_var.rb +0 -0
  24. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_atomic_boolean.rb +0 -0
  25. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_atomic_fixnum.rb +0 -0
  26. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_count_down_latch.rb +0 -0
  27. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_semaphore.rb +0 -0
  28. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/read_write_lock.rb +0 -0
  29. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/reentrant_read_write_lock.rb +0 -0
  30. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/ruby_thread_local_var.rb +60 -40
  31. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/semaphore.rb +0 -0
  32. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/thread_local_var.rb +1 -1
  33. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic_reference/mutex_atomic.rb +0 -0
  34. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic_reference/numeric_cas_wrapper.rb +0 -0
  35. data/lib/{concurrent → concurrent-ruby/concurrent}/atomics.rb +0 -0
  36. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/copy_on_notify_observer_set.rb +0 -0
  37. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/copy_on_write_observer_set.rb +0 -0
  38. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/java_non_concurrent_priority_queue.rb +0 -0
  39. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/lock_free_stack.rb +1 -1
  40. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/atomic_reference_map_backend.rb +0 -0
  41. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/mri_map_backend.rb +1 -1
  42. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/non_concurrent_map_backend.rb +0 -0
  43. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/synchronized_map_backend.rb +0 -0
  44. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/non_concurrent_priority_queue.rb +1 -1
  45. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/ruby_non_concurrent_priority_queue.rb +0 -0
  46. data/lib/{concurrent → concurrent-ruby/concurrent}/concern/deprecation.rb +0 -0
  47. data/lib/{concurrent → concurrent-ruby/concurrent}/concern/dereferenceable.rb +2 -2
  48. data/lib/{concurrent → concurrent-ruby/concurrent}/concern/logging.rb +0 -0
  49. data/lib/{concurrent → concurrent-ruby/concurrent}/concern/obligation.rb +0 -0
  50. data/lib/{concurrent → concurrent-ruby/concurrent}/concern/observable.rb +0 -0
  51. data/lib/concurrent-ruby/concurrent/concurrent_ruby.jar +0 -0
  52. data/lib/{concurrent → concurrent-ruby/concurrent}/configuration.rb +13 -9
  53. data/lib/{concurrent → concurrent-ruby/concurrent}/constants.rb +0 -0
  54. data/lib/{concurrent → concurrent-ruby/concurrent}/dataflow.rb +0 -0
  55. data/lib/{concurrent → concurrent-ruby/concurrent}/delay.rb +0 -0
  56. data/lib/{concurrent → concurrent-ruby/concurrent}/errors.rb +0 -0
  57. data/lib/{concurrent → concurrent-ruby/concurrent}/exchanger.rb +0 -0
  58. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/abstract_executor_service.rb +17 -23
  59. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/cached_thread_pool.rb +4 -4
  60. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/executor_service.rb +2 -2
  61. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/fixed_thread_pool.rb +16 -12
  62. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/immediate_executor.rb +0 -0
  63. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/indirect_immediate_executor.rb +0 -0
  64. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/java_executor_service.rb +18 -6
  65. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/java_single_thread_executor.rb +4 -3
  66. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/java_thread_pool_executor.rb +15 -2
  67. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/ruby_executor_service.rb +0 -2
  68. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/ruby_single_thread_executor.rb +0 -1
  69. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/ruby_thread_pool_executor.rb +20 -5
  70. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/safe_task_executor.rb +0 -0
  71. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/serial_executor_service.rb +0 -0
  72. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/serialized_execution.rb +0 -0
  73. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/serialized_execution_delegator.rb +0 -0
  74. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/simple_executor_service.rb +1 -1
  75. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/single_thread_executor.rb +1 -0
  76. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/thread_pool_executor.rb +2 -1
  77. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/timer_set.rb +13 -16
  78. data/lib/{concurrent → concurrent-ruby/concurrent}/executors.rb +0 -0
  79. data/lib/{concurrent → concurrent-ruby/concurrent}/future.rb +0 -0
  80. data/lib/{concurrent → concurrent-ruby/concurrent}/hash.rb +4 -4
  81. data/lib/{concurrent → concurrent-ruby/concurrent}/immutable_struct.rb +9 -1
  82. data/lib/{concurrent → concurrent-ruby/concurrent}/ivar.rb +0 -0
  83. data/lib/{concurrent → concurrent-ruby/concurrent}/map.rb +1 -1
  84. data/lib/{concurrent → concurrent-ruby/concurrent}/maybe.rb +0 -0
  85. data/lib/{concurrent → concurrent-ruby/concurrent}/mutable_struct.rb +12 -2
  86. data/lib/{concurrent → concurrent-ruby/concurrent}/mvar.rb +0 -0
  87. data/lib/{concurrent → concurrent-ruby/concurrent}/options.rb +0 -0
  88. data/lib/{concurrent → concurrent-ruby/concurrent}/promise.rb +0 -0
  89. data/lib/{concurrent → concurrent-ruby/concurrent}/promises.rb +348 -117
  90. data/lib/{concurrent → concurrent-ruby/concurrent}/re_include.rb +0 -0
  91. data/lib/{concurrent → concurrent-ruby/concurrent}/scheduled_task.rb +0 -0
  92. data/lib/{concurrent → concurrent-ruby/concurrent}/set.rb +5 -5
  93. data/lib/{concurrent → concurrent-ruby/concurrent}/settable_struct.rb +11 -1
  94. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization.rb +0 -0
  95. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/abstract_lockable_object.rb +0 -0
  96. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/abstract_object.rb +0 -0
  97. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/abstract_struct.rb +12 -0
  98. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/condition.rb +2 -0
  99. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/jruby_lockable_object.rb +0 -0
  100. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/jruby_object.rb +1 -0
  101. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/lock.rb +2 -0
  102. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/lockable_object.rb +2 -2
  103. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/mri_object.rb +1 -0
  104. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/mutex_lockable_object.rb +0 -0
  105. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/object.rb +46 -20
  106. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/rbx_lockable_object.rb +0 -0
  107. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/rbx_object.rb +1 -0
  108. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/truffleruby_object.rb +1 -0
  109. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/volatile.rb +0 -0
  110. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/synchronized_delegator.rb +0 -0
  111. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util.rb +0 -0
  112. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/adder.rb +0 -0
  113. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/cheap_lockable.rb +0 -0
  114. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/data_structures.rb +0 -0
  115. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/power_of_two_tuple.rb +0 -0
  116. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/striped64.rb +1 -1
  117. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/volatile.rb +0 -0
  118. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/xor_shift_random.rb +0 -0
  119. data/lib/{concurrent → concurrent-ruby/concurrent}/timer_task.rb +0 -1
  120. data/lib/{concurrent → concurrent-ruby/concurrent}/tuple.rb +0 -0
  121. data/lib/{concurrent → concurrent-ruby/concurrent}/tvar.rb +9 -6
  122. data/lib/{concurrent → concurrent-ruby/concurrent}/utility/engine.rb +0 -0
  123. data/lib/{concurrent → concurrent-ruby/concurrent}/utility/monotonic_time.rb +0 -0
  124. data/lib/{concurrent → concurrent-ruby/concurrent}/utility/native_extension_loader.rb +0 -0
  125. data/lib/{concurrent → concurrent-ruby/concurrent}/utility/native_integer.rb +0 -0
  126. data/lib/{concurrent → concurrent-ruby/concurrent}/utility/processor_counter.rb +5 -0
  127. data/lib/concurrent-ruby/concurrent/version.rb +3 -0
  128. metadata +129 -129
  129. data/lib/concurrent/concurrent_ruby.jar +0 -0
  130. data/lib/concurrent/utility/at_exit.rb +0 -97
  131. data/lib/concurrent/version.rb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: baa8a50b8b08ea03ec40438bf1e921d86a28c2ccc1292535bf9d72aab66fb659
4
- data.tar.gz: cf77c2327c6527a2be4476c2e6464c2b90e86610ecf3543bcee5df5e2c6aa3b0
3
+ metadata.gz: 207cadfd4ec0e25f6ba9881ef8f32ea86c5772074d4aff5e2ab5d5bdf4613e09
4
+ data.tar.gz: b41c0dd080a6d2fbf1d2c97bf2e9a8db0e99849ba875d32ade39384838e20e23
5
5
  SHA512:
6
- metadata.gz: e9a34a06cc1efb94d36d986369efefb8df61bfe1bd4b0bf960ab84028bf68e6a60636fcaa453490b38c5ced3d8b628e62f92e2524dd08ac1912ccbb74ba40aeb
7
- data.tar.gz: 51790fe6686917f9a11e5e8fc82af16959bdc7ef8111348bfaad010ad1babc97cfde0048407f98cf11002e789a53e5eddff65a58977f87c4825fab06d4a20a11
6
+ metadata.gz: 4edf0b84df6aa42a69c6ff231c730d12a64df6819ebea508599b469d88951c47ce4b091d3f3fc41afcb9196986091efe57d156161510f03cfb8ee0ebaf66ff0c
7
+ data.tar.gz: a18c3ef751cadd220d424779e96d96ead76362ad4e7bfcfb2341d9ba4baed6f0b8427c452e31868e512ab2b3a8226fe350041e0e5b87cd28e10d9ce1b5334c72
@@ -1,5 +1,56 @@
1
1
  ## Current
2
2
 
3
+ ## Release v1.1.8 (20 January 2021)
4
+
5
+ * (#885) Fix race condition in TVar for stale reads
6
+ * (#884) RubyThreadLocalVar: Do not iterate over hash which might conflict with new pair addition
7
+
8
+ ## Release v1.1.7 (6 August 2020)
9
+
10
+ concurrent-ruby:
11
+
12
+ * (#879) Consider falsy value on `Concurrent::Map#compute_if_absent` for fast non-blocking path
13
+ * (#876) Reset Async queue on forking, makes Async fork-safe
14
+ * (#856) Avoid running problematic code in RubyThreadLocalVar on MRI that occasionally results in segfault
15
+ * (#853) Introduce ThreadPoolExecutor without a Queue
16
+
17
+ ## Release v1.1.6, edge v0.6.0 (10 Feb 2020)
18
+
19
+ concurrent-ruby:
20
+
21
+ * (#841) Concurrent.disable_at_exit_handlers! is no longer needed and was deprecated.
22
+ * (#841) AbstractExecutorService#auto_terminate= was deprecated and has no effect.
23
+ Set :auto_terminate option instead when executor is initialized.
24
+
25
+ ## Release v1.1.6.pre1, edge v0.6.0.pre1 (26 Jan 2020)
26
+
27
+ concurrent-ruby:
28
+
29
+ * (#828) Allow to name executors, the name is also used to name their threads
30
+ * (#838) Implement #dup and #clone for structs
31
+ * (#821) Safer finalizers for thread local variables
32
+ * Documentation fixes
33
+ * (#814) Use Ruby's Etc.nprocessors if available
34
+ * (#812) Fix directory structure not to mess with packaging tools
35
+ * (#840) Fix termination of pools on JRuby
36
+
37
+ concurrent-ruby-edge:
38
+
39
+ * Add WrappingExecutor (#830)
40
+
41
+ ## Release v1.1.5, edge v0.5.0 (10 Mar 2019)
42
+
43
+ concurrent-ruby:
44
+
45
+ * fix potential leak of context on JRuby and Java 7
46
+
47
+ concurrent-ruby-edge:
48
+
49
+ * Add finalized Concurrent::Cancellation
50
+ * Add finalized Concurrent::Throttle
51
+ * Add finalized Concurrent::Promises::Channel
52
+ * Add new Concurrent::ErlangActor
53
+
3
54
  ## Release v1.1.4 (14 Dec 2018)
4
55
 
5
56
  * (#780) Remove java_alias of 'submit' method of Runnable to let executor service work on java 11
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- require File.join(File.dirname(__FILE__ ), 'lib/concurrent/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')
5
+ require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby/concurrent/utility/engine')
4
6
 
5
7
  no_path = ENV['NO_PATH']
6
8
  options = no_path ? {} : { path: '.' }
@@ -10,27 +12,28 @@ gem 'concurrent-ruby-edge', Concurrent::EDGE_VERSION, options
10
12
  gem 'concurrent-ruby-ext', Concurrent::VERSION, options.merge(platform: :mri)
11
13
 
12
14
  group :development do
13
- gem 'rake', '~> 12.0'
14
- gem 'rake-compiler', '~> 1.0'
15
- gem 'rake-compiler-dock', '~> 0.6.0'
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', '~> 1.0'
16
18
  gem 'pry', '~> 0.11', platforms: :mri
17
19
  end
18
20
 
19
21
  group :documentation, optional: true do
20
- gem 'yard', '~> 0.9.0', :require => false
22
+ gem 'yard', '~> 0.9.0', require: false
21
23
  gem 'redcarpet', '~> 3.0', platforms: :mri # understands github markdown
22
- gem 'md-ruby-eval', '~> 0.3'
24
+ gem 'md-ruby-eval', '~> 0.6'
23
25
  end
24
26
 
25
27
  group :testing do
26
28
  gem 'rspec', '~> 3.7'
27
29
  gem 'timecop', '~> 0.7.4'
30
+ gem 'sigdump', require: false
28
31
  end
29
32
 
30
33
  # made opt-in since it will not install on jruby 1.7
31
34
  group :coverage, optional: !ENV['COVERAGE'] do
32
- gem 'simplecov', '~> 0.10.0', :require => false
33
- gem 'coveralls', '~> 0.8.2', :require => false
35
+ gem 'simplecov', '~> 0.16.0', require: false
36
+ gem 'coveralls', '~> 0.8.2', require: false
34
37
  end
35
38
 
36
39
  group :benchmarks, optional: true do
@@ -1,23 +1,21 @@
1
- ```
2
1
  Copyright (c) Jerry D'Antonio -- released under the MIT license.
3
2
 
4
- http://www.opensource.org/licenses/mit-license.php
3
+ http://www.opensource.org/licenses/mit-license.php
5
4
 
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
23
- ```
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -42,7 +42,7 @@ appreciate your help. Would you like to contribute? Great! Have a look at
42
42
  ## Thread Safety
43
43
 
44
44
  *Concurrent Ruby makes one of the strongest thread safety guarantees of any Ruby concurrency
45
- library, providing consistent behavior and guarantees on all three of the main Ruby interpreters
45
+ library, providing consistent behavior and guarantees on all four of the main Ruby interpreters
46
46
  (MRI/CRuby, JRuby, Rubinius, TruffleRuby).*
47
47
 
48
48
  Every abstraction in this library is thread safe. Specific thread safety guarantees are documented
@@ -105,9 +105,9 @@ We also have a [IRC (gitter)](https://gitter.im/ruby-concurrency/concurrent-ruby
105
105
  Collection classes that were originally part of the (deprecated) `thread_safe` gem:
106
106
 
107
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).
108
+ subclass of Ruby's standard [Array](http://ruby-doc.org/core/Array.html).
109
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).
110
+ subclass of Ruby's standard [Hash](http://ruby-doc.org/core/Hash.html).
111
111
  * [Set](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Set.html) A thread-safe
112
112
  subclass of Ruby's standard [Set](http://ruby-doc.org/stdlib-2.4.0/libdoc/set/rdoc/Set.html).
113
113
  * [Map](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Map.html) A hash-like object
@@ -122,7 +122,7 @@ Value objects inspired by other languages:
122
122
  immutable object representing an optional value, based on
123
123
  [Haskell Data.Maybe](https://hackage.haskell.org/package/base-4.2.0.1/docs/Data-Maybe.html).
124
124
 
125
- Structure classes derived from Ruby's [Struct](http://ruby-doc.org/core-2.2.0/Struct.html):
125
+ Structure classes derived from Ruby's [Struct](http://ruby-doc.org/core/Struct.html):
126
126
 
127
127
  * [ImmutableStruct](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ImmutableStruct.html)
128
128
  Immutable struct where values are set at construction and cannot be changed later.
@@ -224,6 +224,38 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m
224
224
  *Status: will be moved to core soon.*
225
225
  * [LockFreeStack](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/LockFreeStack.html)
226
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.
227
259
 
228
260
  ## Supported Ruby versions
229
261
 
@@ -339,11 +371,14 @@ and to the past maintainers
339
371
  * [Paweł Obrok](https://github.com/obrok)
340
372
  * [Lucas Allan](https://github.com/lucasallan)
341
373
 
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.
376
+
342
377
  ## License and Copyright
343
378
 
344
379
  *Concurrent Ruby* is free software released under the
345
380
  [MIT License](http://www.opensource.org/licenses/MIT).
346
381
 
347
- The *Concurrent Ruby* [logo](https://github.com/ruby-concurrency/concurrent-ruby/wiki/Logo) was
382
+ The *Concurrent Ruby* [logo](https://raw.githubusercontent.com/ruby-concurrency/concurrent-ruby/master/docs-source/logo/concurrent-ruby-logo-300x300.png) was
348
383
  designed by [David Jones](https://twitter.com/zombyboy). It is Copyright &copy; 2014
349
384
  [Jerry D'Antonio](https://twitter.com/jerrydantonio). All Rights Reserved.
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
- #!/usr/bin/env rake
2
-
3
- require_relative 'lib/concurrent/version'
4
- 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'
5
4
 
6
5
  if Concurrent.ruby_version :<, 2, 0, 0
7
6
  # @!visibility private
@@ -18,45 +17,11 @@ edge_gemspec = Gem::Specification.load File.join(__dir__, 'concurrent-ruby-edge.
18
17
 
19
18
  require 'rake/javaextensiontask'
20
19
 
21
- class ConcurrentRubyJavaExtensionTask < Rake::JavaExtensionTask
22
- def java_classpath_arg(*args)
23
- jruby_cpath = nil
24
-
25
- if RUBY_PLATFORM =~ /java/
26
- begin
27
- cpath = Java::java.lang.System.getProperty('java.class.path').split(File::PATH_SEPARATOR)
28
- cpath += Java::java.lang.System.getProperty('sun.boot.class.path').split(File::PATH_SEPARATOR)
29
- jruby_cpath = cpath.compact.join(File::PATH_SEPARATOR)
30
- rescue => e
31
- end
32
-
33
- unless jruby_cpath
34
- libdir = RbConfig::CONFIG['libdir']
35
- if libdir.start_with? "classpath:"
36
- raise 'Cannot build with jruby-complete'
37
- end
38
- jruby_cpath = File.join(libdir, "jruby.jar")
39
- end
40
- end
41
-
42
- unless jruby_cpath
43
- jruby_home = ENV['JRUBY_HOME']
44
- if jruby_home
45
- candidate = File.join(jruby_home, 'lib', 'jruby.jar')
46
- jruby_cpath = candidate if File.exist? candidate
47
- end
48
- end
49
-
50
- raise "jruby.jar path not found" unless jruby_cpath
51
-
52
- jruby_cpath += File::PATH_SEPARATOR + args.join(File::PATH_SEPARATOR) unless args.empty?
53
- jruby_cpath ? "-cp \"#{jruby_cpath}\"" : ""
54
- end
55
- end
20
+ ENV['JRUBY_HOME'] = ENV['CONCURRENT_JRUBY_HOME'] if ENV['CONCURRENT_JRUBY_HOME'] && !Concurrent.on_jruby?
56
21
 
57
- ConcurrentRubyJavaExtensionTask.new('concurrent_ruby', core_gemspec) do |ext|
22
+ Rake::JavaExtensionTask.new('concurrent_ruby', core_gemspec) do |ext|
58
23
  ext.ext_dir = 'ext/concurrent-ruby'
59
- ext.lib_dir = 'lib/concurrent'
24
+ ext.lib_dir = 'lib/concurrent-ruby/concurrent'
60
25
  end
61
26
 
62
27
  unless Concurrent.on_jruby?
@@ -64,7 +29,7 @@ unless Concurrent.on_jruby?
64
29
 
65
30
  Rake::ExtensionTask.new('concurrent_ruby_ext', ext_gemspec) do |ext|
66
31
  ext.ext_dir = 'ext/concurrent-ruby-ext'
67
- ext.lib_dir = 'lib/concurrent'
32
+ ext.lib_dir = 'lib/concurrent-ruby/concurrent'
68
33
  ext.source_pattern = '*.{c,h}'
69
34
 
70
35
  ext.cross_compile = true
@@ -80,9 +45,13 @@ namespace :repackage do
80
45
  # store gems in vendor cache for docker
81
46
  sh 'bundle package'
82
47
 
83
- # needed only if the jar is built outside of docker
84
- Rake::Task['lib/concurrent/concurrent_ruby.jar'].invoke
85
- RakeCompilerDock.exec 'support/cross_building.sh'
48
+ # build only the jar file not the whole gem for java platform, the jar is part the concurrent-ruby-x.y.z.gem
49
+ Rake::Task['lib/concurrent-ruby/concurrent/concurrent_ruby.jar'].invoke
50
+
51
+ # build all gem files
52
+ %w[x86-mingw32 x64-mingw32].each do |plat|
53
+ RakeCompilerDock.sh "bundle install --local && bundle exec rake native:#{plat} gem --trace", platform: plat
54
+ end
86
55
  end
87
56
  end
88
57
  end
@@ -94,7 +63,7 @@ Gem::PackageTask.new(core_gemspec) {} if core_gemspec
94
63
  Gem::PackageTask.new(ext_gemspec) {} if ext_gemspec && !Concurrent.on_jruby?
95
64
  Gem::PackageTask.new(edge_gemspec) {} if edge_gemspec
96
65
 
97
- CLEAN.include('lib/concurrent/2.*', 'lib/concurrent/*.jar')
66
+ CLEAN.include('lib/concurrent-ruby/concurrent/2.*', 'lib/concurrent-ruby/concurrent/*.jar')
98
67
 
99
68
  begin
100
69
  require 'rspec'
@@ -102,15 +71,14 @@ begin
102
71
 
103
72
  RSpec::Core::RakeTask.new(:spec)
104
73
 
105
- options = %w[ --color
106
- --backtrace
107
- --seed 1
108
- --format documentation
109
- --tag ~notravis ]
110
-
111
74
  namespace :spec do
112
75
  desc '* Configured for ci'
113
76
  RSpec::Core::RakeTask.new(:ci) do |t|
77
+ options = %w[ --color
78
+ --backtrace
79
+ --order defined
80
+ --format documentation
81
+ --tag ~notravis ]
114
82
  t.rspec_opts = [*options].join(' ')
115
83
  end
116
84
 
@@ -135,7 +103,7 @@ rescue LoadError => e
135
103
  puts 'RSpec is not installed, skipping test task definitions: ' + e.message
136
104
  end
137
105
 
138
- current_yard_version_name = [*Concurrent::VERSION.split('.')[0..1], 'x'].join('.')
106
+ current_yard_version_name = Concurrent::VERSION
139
107
 
140
108
  begin
141
109
  require 'yard'
@@ -185,22 +153,34 @@ begin
185
153
  end
186
154
 
187
155
  define_yard_task = -> name do
156
+ output_dir = "docs/#{name}"
157
+
158
+ removal_name = "remove.#{name}"
159
+ task removal_name do
160
+ Dir.chdir __dir__ do
161
+ FileUtils.rm_rf output_dir
162
+ end
163
+ end
164
+
188
165
  desc "* of #{name} into subdir #{name}"
189
166
  YARD::Rake::YardocTask.new(name) do |yard|
190
167
  yard.options.push(
191
- '--output-dir', "docs/#{name}",
168
+ '--output-dir', output_dir,
192
169
  '--main', 'tmp/README.md',
193
170
  *common_yard_options)
194
- yard.files = ['./lib/**/*.rb',
195
- './lib-edge/**/*.rb',
171
+ yard.files = ['./lib/concurrent-ruby/**/*.rb',
172
+ './lib/concurrent-ruby-edge/**/*.rb',
196
173
  './ext/concurrent_ruby_ext/**/*.c',
197
174
  '-',
198
175
  'docs-source/thread_pools.md',
199
176
  'docs-source/promises.out.md',
200
- 'LICENSE.md',
177
+ 'docs-source/medium-example.out.rb',
178
+ 'LICENSE.txt',
201
179
  'CHANGELOG.md']
202
180
  end
203
- Rake::Task[name].prerequisites.push 'yard:eval_md', 'yard:update_readme'
181
+ Rake::Task[name].prerequisites.push removal_name,
182
+ # 'yard:eval_md',
183
+ 'yard:update_readme'
204
184
  end
205
185
 
206
186
  define_yard_task.call current_yard_version_name
@@ -223,7 +203,15 @@ begin
223
203
  begin
224
204
  FileUtils.cp_r 'docs', 'docs-copy', verbose: true
225
205
  Rake::Task["yard:#{name}"].invoke
226
- sh 'diff -r docs/ docs-copy/'
206
+ sh 'diff -r docs/ docs-copy/' do |ok, res|
207
+ unless ok
208
+ begin
209
+ STDOUT.puts 'Command failed. Continue? (y/n)'
210
+ input = STDIN.gets.strip.downcase
211
+ end until %w(y n).include?(input)
212
+ exit 1 if input == 'n'
213
+ end
214
+ end
227
215
  ensure
228
216
  FileUtils.rm_rf 'docs-copy', verbose: true
229
217
  end
@@ -246,8 +234,8 @@ task :release => ['release:checks', 'release:build', 'release:test', 'release:pu
246
234
  namespace :release do
247
235
  # Depends on environment of @pitr-ch
248
236
 
249
- mri_version = '2.5.1'
250
- jruby_version = 'jruby-9.1.17.1'
237
+ mri_version = '2.6.5'
238
+ jruby_version = 'jruby-9.2.9.0'
251
239
 
252
240
  task :checks => "yard:#{current_yard_version_name}:uptodate" do
253
241
  Dir.chdir(__dir__) do
@@ -275,7 +263,7 @@ namespace :release do
275
263
  end
276
264
 
277
265
  desc '* build all *.gem files necessary for release'
278
- task :build => 'repackage:all'
266
+ task :build => [:clobber, 'repackage:all']
279
267
 
280
268
  desc '* test actual installed gems instead of cloned repository on MRI and JRuby'
281
269
  task :test do
@@ -316,7 +304,7 @@ namespace :release do
316
304
  end
317
305
 
318
306
  desc '** tag HEAD with current version and push to github'
319
- task :tag do
307
+ task :tag => :ask do
320
308
  Dir.chdir(__dir__) do
321
309
  sh "git tag v#{Concurrent::VERSION}"
322
310
  sh "git push origin v#{Concurrent::VERSION}"
@@ -326,7 +314,7 @@ namespace :release do
326
314
  end
327
315
 
328
316
  desc '** push all *.gem files to rubygems'
329
- task :rubygems do
317
+ task :rubygems => :ask do
330
318
  Dir.chdir(__dir__) do
331
319
  sh "gem push pkg/concurrent-ruby-#{Concurrent::VERSION}.gem"
332
320
  sh "gem push pkg/concurrent-ruby-edge-#{Concurrent::EDGE_VERSION}.gem" if publish_edge