concurrent-ruby 1.1.5 → 1.1.9

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 -1
  3. data/Gemfile +5 -4
  4. data/{LICENSE.md → LICENSE.txt} +18 -20
  5. data/README.md +34 -7
  6. data/Rakefile +44 -32
  7. data/lib/{concurrent-ruby.rb → concurrent-ruby/concurrent-ruby.rb} +0 -0
  8. data/lib/{concurrent.rb → concurrent-ruby/concurrent.rb} +0 -0
  9. data/lib/{concurrent → concurrent-ruby/concurrent}/agent.rb +0 -0
  10. data/lib/{concurrent → concurrent-ruby/concurrent}/array.rb +6 -6
  11. data/lib/{concurrent → concurrent-ruby/concurrent}/async.rb +9 -20
  12. data/lib/{concurrent → concurrent-ruby/concurrent}/atom.rb +1 -1
  13. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/abstract_thread_local_var.rb +0 -0
  14. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_boolean.rb +2 -2
  15. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_fixnum.rb +0 -0
  16. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_markable_reference.rb +0 -0
  17. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_reference.rb +0 -0
  18. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/count_down_latch.rb +1 -1
  19. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/cyclic_barrier.rb +0 -0
  20. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/event.rb +0 -0
  21. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/java_count_down_latch.rb +0 -0
  22. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/java_thread_local_var.rb +0 -0
  23. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_atomic_boolean.rb +0 -0
  24. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_atomic_fixnum.rb +0 -0
  25. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_count_down_latch.rb +0 -0
  26. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_semaphore.rb +0 -0
  27. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/read_write_lock.rb +0 -0
  28. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/reentrant_read_write_lock.rb +0 -0
  29. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/ruby_thread_local_var.rb +60 -40
  30. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/semaphore.rb +0 -0
  31. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/thread_local_var.rb +1 -1
  32. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic_reference/mutex_atomic.rb +0 -0
  33. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic_reference/numeric_cas_wrapper.rb +0 -0
  34. data/lib/{concurrent → concurrent-ruby/concurrent}/atomics.rb +0 -0
  35. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/copy_on_notify_observer_set.rb +0 -0
  36. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/copy_on_write_observer_set.rb +0 -0
  37. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/java_non_concurrent_priority_queue.rb +0 -0
  38. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/lock_free_stack.rb +0 -0
  39. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/atomic_reference_map_backend.rb +0 -0
  40. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/mri_map_backend.rb +1 -1
  41. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/non_concurrent_map_backend.rb +0 -0
  42. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/synchronized_map_backend.rb +0 -0
  43. data/lib/concurrent-ruby/concurrent/collection/map/truffleruby_map_backend.rb +14 -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 +11 -1
  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 +0 -1
  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 +1 -1
  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 +14 -4
  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 +1 -0
  89. data/lib/{concurrent → concurrent-ruby/concurrent}/promises.rb +0 -0
  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 +19 -11
  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 +11 -0
  98. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/condition.rb +0 -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 +0 -0
  101. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/lock.rb +0 -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 +0 -0
  104. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/mutex_lockable_object.rb +12 -0
  105. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/object.rb +0 -0
  106. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/rbx_lockable_object.rb +6 -0
  107. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/rbx_object.rb +0 -0
  108. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/truffleruby_object.rb +0 -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 +26 -1
  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 +128 -128
  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 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96f32c31090c8a0547e4ee452739bdc993aad1256e2c89cb9a46d7f7e7b5762a
4
- data.tar.gz: 307d26bde3add56b7e2b37fb0b016c7726a3ba0755dcfec8202fb0760e4ac485
3
+ metadata.gz: 4e26dce842bfb7973c28f13017d50c3e729a9261f48427920db279055c4d089b
4
+ data.tar.gz: 501e9d485d4683657b49cd5820ef0462ce91133ad163ba9e790f254892d1e533
5
5
  SHA512:
6
- metadata.gz: b8cff93c6ef396aebbe5cf69734d9a91f0351e24b5c1846ae105b055254f972cd9d6bb99b90ce10d387627ed43c4e21db9ce47d1587e10278e80e33a53f8d4c4
7
- data.tar.gz: f367f097759eedb8e18b0117543176c9f30ab29552888fcedab0baaea355cee3d100d2559dd16cf54483778545097f8b3340bebe44b0e3ab2a51c1af3830f5e1
6
+ metadata.gz: 7f894d3207ce129044970321fabe750cc4b9744a876f354dd791d045fb4ffed1d0a5a9a50dcb1ab0ca36df705b6b7578fe7eded26bcaa3dbeb0c7a12e655596c
7
+ data.tar.gz: 3cb4ccbbf13e2f73987eda48a32b444d7330c53a668ddef2fd4a73841caf18805d68cec45273a02de2c10087da4a4ce063c01b1bdccb96d4668b10cc4af79f88
data/CHANGELOG.md CHANGED
@@ -1,6 +1,56 @@
1
1
  ## Current
2
2
 
3
- ## Release v1.1.5, edge v0.5.0 (10 mar 2019)
3
+ ## Release v1.1.9 (5 Jun 2021)
4
+
5
+ concurrent-ruby:
6
+
7
+ * (#866) Child promise state not set to :pending immediately after #execute when parent has completed
8
+ * (#905, #872) Fix RubyNonConcurrentPriorityQueue#delete method
9
+ * (2df0337d) Make sure locks are not shared on shared when objects are dup/cloned
10
+ * (#900, #906, #796, #847, #911) Fix Concurrent::Set tread-safety issues on CRuby
11
+ * (#907) Add new ConcurrentMap backend for TruffleRuby
12
+
13
+ ## Release v1.1.8 (20 January 2021)
14
+
15
+ concurrent-ruby:
16
+
17
+ * (#885) Fix race condition in TVar for stale reads
18
+ * (#884) RubyThreadLocalVar: Do not iterate over hash which might conflict with new pair addition
19
+
20
+ ## Release v1.1.7 (6 August 2020)
21
+
22
+ concurrent-ruby:
23
+
24
+ * (#879) Consider falsy value on `Concurrent::Map#compute_if_absent` for fast non-blocking path
25
+ * (#876) Reset Async queue on forking, makes Async fork-safe
26
+ * (#856) Avoid running problematic code in RubyThreadLocalVar on MRI that occasionally results in segfault
27
+ * (#853) Introduce ThreadPoolExecutor without a Queue
28
+
29
+ ## Release v1.1.6, edge v0.6.0 (10 Feb 2020)
30
+
31
+ concurrent-ruby:
32
+
33
+ * (#841) Concurrent.disable_at_exit_handlers! is no longer needed and was deprecated.
34
+ * (#841) AbstractExecutorService#auto_terminate= was deprecated and has no effect.
35
+ Set :auto_terminate option instead when executor is initialized.
36
+
37
+ ## Release v1.1.6.pre1, edge v0.6.0.pre1 (26 Jan 2020)
38
+
39
+ concurrent-ruby:
40
+
41
+ * (#828) Allow to name executors, the name is also used to name their threads
42
+ * (#838) Implement #dup and #clone for structs
43
+ * (#821) Safer finalizers for thread local variables
44
+ * Documentation fixes
45
+ * (#814) Use Ruby's Etc.nprocessors if available
46
+ * (#812) Fix directory structure not to mess with packaging tools
47
+ * (#840) Fix termination of pools on JRuby
48
+
49
+ concurrent-ruby-edge:
50
+
51
+ * Add WrappingExecutor (#830)
52
+
53
+ ## Release v1.1.5, edge v0.5.0 (10 Mar 2019)
4
54
 
5
55
  concurrent-ruby:
6
56
 
data/Gemfile CHANGED
@@ -1,7 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
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')
5
+ require File.join(File.dirname(__FILE__ ), 'lib/concurrent-ruby/concurrent/utility/engine')
5
6
 
6
7
  no_path = ENV['NO_PATH']
7
8
  options = no_path ? {} : { path: '.' }
@@ -11,9 +12,9 @@ gem 'concurrent-ruby-edge', Concurrent::EDGE_VERSION, options
11
12
  gem 'concurrent-ruby-ext', Concurrent::VERSION, options.merge(platform: :mri)
12
13
 
13
14
  group :development do
14
- gem 'rake', '~> 12.0'
15
+ gem 'rake', (Concurrent.ruby_version :<, 2, 2, 0) ? '~> 12.0' : '~> 13.0'
15
16
  gem 'rake-compiler', '~> 1.0', '>= 1.0.7'
16
- gem 'rake-compiler-dock', '~> 0.7.0'
17
+ gem 'rake-compiler-dock', '~> 1.0'
17
18
  gem 'pry', '~> 0.11', platforms: :mri
18
19
  end
19
20
 
@@ -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
@@ -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.
@@ -253,6 +253,9 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m
253
253
  * [ErlangActor](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ErlangActor.html)
254
254
  Actor implementation which precisely matches Erlang actor behaviour.
255
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.
256
259
 
257
260
  ## Supported Ruby versions
258
261
 
@@ -350,19 +353,43 @@ and load the appropriate C extensions.
350
353
  No gems should depend on `concurrent-ruby-ext`. Doing so will force C extensions on your users. The
351
354
  best practice is to depend on `concurrent-ruby` and let users to decide if they want C extensions.
352
355
 
356
+ ## Building the gem
357
+
358
+ ### Requirements
359
+
360
+ * Recent CRuby
361
+ * JRuby, `rbenv install jruby-9.2.17.0`
362
+ * Set env variable `CONCURRENT_JRUBY_HOME` to point to it, e.g. `/usr/local/opt/rbenv/versions/jruby-9.2.17.0`
363
+ * Install Docker, required for Windows builds
364
+
365
+ ### Publishing the Gem
366
+
367
+ * Update`version.rb`
368
+ * Update the CHANGELOG
369
+ * Update the Yard documentation
370
+ - Add the new version to `docs-source/signpost.md`. Needs to be done only if there are visible changes in the
371
+ documentation.
372
+ - Run `bundle exec rake yard` to update the master documentation and signpost.
373
+ - Run `bundle exec rake yard:<new-version>` to add or update the documentation of the new version.
374
+ * Commit (and push) the changes.
375
+ * Use `be rake release` to release the gem. It consists
376
+ of `['release:checks', 'release:build', 'release:test', 'release:publish']` steps. It will ask at the end before
377
+ publishing anything. Steps can also be executed individually.
378
+
353
379
  ## Maintainers
354
380
 
355
- * [Petr Chalupa](https://github.com/pitr-ch) (lead maintainer, point-of-contact)
356
- * [Jerry D'Antonio](https://github.com/jdantonio) (creator)
357
- * [Chris Seaton](https://github.com/chrisseaton)
381
+ * [Petr Chalupa](https://github.com/pitr-ch) Lead maintainer, point-of-contact.
382
+ * [Chris Seaton](https://github.com/chrisseaton)
383
+ If Petr is not available Chris can help or poke Petr to pay attention where it is needed.
358
384
 
359
385
  ### Special Thanks to
360
386
 
387
+ * [Jerry D'Antonio](https://github.com/jdantonio) for creating the gem
361
388
  * [Brian Durand](https://github.com/bdurand) for the `ref` gem
362
389
  * [Charles Oliver Nutter](https://github.com/headius) for the `atomic` and `thread_safe` gems
363
390
  * [thedarkone](https://github.com/thedarkone) for the `thread_safe` gem
364
391
 
365
- and to the past maintainers
392
+ to the past maintainers
366
393
 
367
394
  * [Michele Della Torre](https://github.com/mighe)
368
395
  * [Paweł Obrok](https://github.com/obrok)
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
- require_relative 'lib/concurrent/version'
2
- 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'
3
4
 
4
5
  if Concurrent.ruby_version :<, 2, 0, 0
5
6
  # @!visibility private
@@ -16,9 +17,11 @@ edge_gemspec = Gem::Specification.load File.join(__dir__, 'concurrent-ruby-edge.
16
17
 
17
18
  require 'rake/javaextensiontask'
18
19
 
20
+ ENV['JRUBY_HOME'] = ENV['CONCURRENT_JRUBY_HOME'] if ENV['CONCURRENT_JRUBY_HOME'] && !Concurrent.on_jruby?
21
+
19
22
  Rake::JavaExtensionTask.new('concurrent_ruby', core_gemspec) do |ext|
20
23
  ext.ext_dir = 'ext/concurrent-ruby'
21
- ext.lib_dir = 'lib/concurrent'
24
+ ext.lib_dir = 'lib/concurrent-ruby/concurrent'
22
25
  end
23
26
 
24
27
  unless Concurrent.on_jruby?
@@ -26,7 +29,7 @@ unless Concurrent.on_jruby?
26
29
 
27
30
  Rake::ExtensionTask.new('concurrent_ruby_ext', ext_gemspec) do |ext|
28
31
  ext.ext_dir = 'ext/concurrent-ruby-ext'
29
- ext.lib_dir = 'lib/concurrent'
32
+ ext.lib_dir = 'lib/concurrent-ruby/concurrent'
30
33
  ext.source_pattern = '*.{c,h}'
31
34
 
32
35
  ext.cross_compile = true
@@ -43,10 +46,12 @@ namespace :repackage do
43
46
  sh 'bundle package'
44
47
 
45
48
  # build only the jar file not the whole gem for java platform, the jar is part the concurrent-ruby-x.y.z.gem
46
- Rake::Task['lib/concurrent/concurrent_ruby.jar'].invoke
49
+ Rake::Task['lib/concurrent-ruby/concurrent/concurrent_ruby.jar'].invoke
47
50
 
48
51
  # build all gem files
49
- RakeCompilerDock.sh 'bundle install --local && bundle exec rake cross native package --trace'
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
50
55
  end
51
56
  end
52
57
  end
@@ -58,7 +63,7 @@ Gem::PackageTask.new(core_gemspec) {} if core_gemspec
58
63
  Gem::PackageTask.new(ext_gemspec) {} if ext_gemspec && !Concurrent.on_jruby?
59
64
  Gem::PackageTask.new(edge_gemspec) {} if edge_gemspec
60
65
 
61
- CLEAN.include('lib/concurrent/2.*', 'lib/concurrent/*.jar')
66
+ CLEAN.include('lib/concurrent-ruby/concurrent/2.*', 'lib/concurrent-ruby/concurrent/*.jar')
62
67
 
63
68
  begin
64
69
  require 'rspec'
@@ -130,7 +135,7 @@ begin
130
135
  task :update_readme do
131
136
  Dir.chdir __dir__ do
132
137
  content = File.read(File.join('README.md')).
133
- gsub(/\[([\w ]+)\]\(http:\/\/ruby-concurrency\.github\.io\/concurrent-ruby\/master\/.*\)/) do |_|
138
+ gsub(/\[([\w ]+)\]\(http:\/\/ruby-concurrency\.github\.io\/concurrent-ruby\/master\/.*\)/) do |_|
134
139
  case $1
135
140
  when 'LockFreeLinkedSet'
136
141
  "{Concurrent::Edge::#{$1} #{$1}}"
@@ -160,20 +165,22 @@ begin
160
165
  desc "* of #{name} into subdir #{name}"
161
166
  YARD::Rake::YardocTask.new(name) do |yard|
162
167
  yard.options.push(
163
- '--output-dir', output_dir,
164
- '--main', 'tmp/README.md',
165
- *common_yard_options)
166
- yard.files = ['./lib/**/*.rb',
167
- './lib-edge/**/*.rb',
168
+ '--output-dir', output_dir,
169
+ '--main', 'tmp/README.md',
170
+ *common_yard_options)
171
+ yard.files = ['./lib/concurrent-ruby/**/*.rb',
172
+ './lib/concurrent-ruby-edge/**/*.rb',
168
173
  './ext/concurrent_ruby_ext/**/*.c',
169
174
  '-',
170
175
  'docs-source/thread_pools.md',
171
176
  'docs-source/promises.out.md',
172
177
  'docs-source/medium-example.out.rb',
173
- 'LICENSE.md',
178
+ 'LICENSE.txt',
174
179
  'CHANGELOG.md']
175
180
  end
176
- Rake::Task[name].prerequisites.push removal_name, 'yard:eval_md', 'yard:update_readme'
181
+ Rake::Task[name].prerequisites.push removal_name,
182
+ # 'yard:eval_md',
183
+ 'yard:update_readme'
177
184
  end
178
185
 
179
186
  define_yard_task.call current_yard_version_name
@@ -182,9 +189,9 @@ begin
182
189
  desc "* signpost for versions"
183
190
  YARD::Rake::YardocTask.new(:signpost) do |yard|
184
191
  yard.options.push(
185
- '--output-dir', 'docs',
186
- '--main', 'docs-source/signpost.md',
187
- *common_yard_options)
192
+ '--output-dir', 'docs',
193
+ '--main', 'docs-source/signpost.md',
194
+ *common_yard_options)
188
195
  yard.files = ['no-lib']
189
196
  end
190
197
 
@@ -199,7 +206,7 @@ begin
199
206
  sh 'diff -r docs/ docs-copy/' do |ok, res|
200
207
  unless ok
201
208
  begin
202
- STDOUT.puts 'Command failed. Continue? (y/n)'
209
+ STDOUT.puts "yard:#{name} is not properly generated and committed.", "Continue? (y/n)"
203
210
  input = STDIN.gets.strip.downcase
204
211
  end until %w(y n).include?(input)
205
212
  exit 1 if input == 'n'
@@ -227,15 +234,13 @@ task :release => ['release:checks', 'release:build', 'release:test', 'release:pu
227
234
  namespace :release do
228
235
  # Depends on environment of @pitr-ch
229
236
 
230
- mri_version = '2.5.1'
231
- jruby_version = 'jruby-9.1.17.1'
232
-
233
237
  task :checks => "yard:#{current_yard_version_name}:uptodate" do
234
238
  Dir.chdir(__dir__) do
235
239
  sh 'test -z "$(git status --porcelain)"' do |ok, res|
236
240
  unless ok
237
241
  begin
238
- STDOUT.puts 'Command failed. Continue? (y/n)'
242
+ status = `git status --porcelain`
243
+ STDOUT.puts 'There are local changes that you might want to commit.', status, 'Continue? (y/n)'
239
244
  input = STDIN.gets.strip.downcase
240
245
  end until %w(y n).include?(input)
241
246
  exit 1 if input == 'n'
@@ -243,10 +248,10 @@ namespace :release do
243
248
  end
244
249
  sh 'git fetch'
245
250
  sh 'test $(git show-ref --verify --hash refs/heads/master) = ' +
246
- '$(git show-ref --verify --hash refs/remotes/origin/master)' do |ok, res|
251
+ '$(git show-ref --verify --hash refs/remotes/origin/master)' do |ok, res|
247
252
  unless ok
248
253
  begin
249
- STDOUT.puts 'Command failed. Continue? (y/n)'
254
+ STDOUT.puts 'Local master branch is not pushed to origin.', 'Continue? (y/n)'
250
255
  input = STDIN.gets.strip.downcase
251
256
  end until %w(y n).include?(input)
252
257
  exit 1 if input == 'n'
@@ -263,6 +268,12 @@ namespace :release do
263
268
  Dir.chdir(__dir__) do
264
269
  old = ENV['RBENV_VERSION']
265
270
 
271
+ mri_version = `ruby -e 'puts RUBY_VERSION'`.chomp
272
+ jruby_version = File.basename(ENV['CONCURRENT_JRUBY_HOME'])
273
+
274
+ puts "Using following version:"
275
+ pp mri_version: mri_version, jruby_version: jruby_version
276
+
266
277
  ENV['RBENV_VERSION'] = mri_version
267
278
  sh 'rbenv version'
268
279
  sh 'bundle exec rake spec:installed'
@@ -285,19 +296,19 @@ namespace :release do
285
296
 
286
297
  task :ask do
287
298
  begin
288
- STDOUT.puts 'Do you want to publish anything? (y/n)'
299
+ STDOUT.puts 'Do you want to publish anything now? (y/n)'
289
300
  input = STDIN.gets.strip.downcase
290
301
  end until %w(y n).include?(input)
291
302
  exit 1 if input == 'n'
292
303
  begin
293
- STDOUT.puts 'Do you want to publish edge? (y/n)'
304
+ STDOUT.puts 'It will publish `concurrent-ruby`. Do you want to publish `concurrent-ruby-edge`? (y/n)'
294
305
  input = STDIN.gets.strip.downcase
295
306
  end until %w(y n).include?(input)
296
307
  publish_edge = input == 'y'
297
308
  end
298
309
 
299
310
  desc '** tag HEAD with current version and push to github'
300
- task :tag do
311
+ task :tag => :ask do
301
312
  Dir.chdir(__dir__) do
302
313
  sh "git tag v#{Concurrent::VERSION}"
303
314
  sh "git push origin v#{Concurrent::VERSION}"
@@ -307,7 +318,7 @@ namespace :release do
307
318
  end
308
319
 
309
320
  desc '** push all *.gem files to rubygems'
310
- task :rubygems do
321
+ task :rubygems => :ask do
311
322
  Dir.chdir(__dir__) do
312
323
  sh "gem push pkg/concurrent-ruby-#{Concurrent::VERSION}.gem"
313
324
  sh "gem push pkg/concurrent-ruby-edge-#{Concurrent::EDGE_VERSION}.gem" if publish_edge
@@ -319,9 +330,10 @@ namespace :release do
319
330
 
320
331
  desc '** print post release steps'
321
332
  task :post_steps do
322
- puts 'Manually: create a release on GitHub with relevant changelog part'
323
- puts 'Manually: send email same as release with relevant changelog part'
324
- puts 'Manually: tweet'
333
+ # TODO: (petr 05-Jun-2021) automate and renew the process
334
+ # puts 'Manually: create a release on GitHub with relevant changelog part'
335
+ # puts 'Manually: send email same as release with relevant changelog part'
336
+ # puts 'Manually: tweet'
325
337
  end
326
338
  end
327
339
  end
@@ -10,13 +10,13 @@ module Concurrent
10
10
  # or writing at a time. This includes iteration methods like `#each`.
11
11
  #
12
12
  # @note `a += b` is **not** a **thread-safe** operation on
13
- # `Concurrent::Array`. It reads array `a`, then it creates new `Concurrent::Array`
14
- # which is concatenation of `a` and `b`, then it writes the concatenation to `a`.
15
- # The read and write are independent operations they do not form a single atomic
16
- # operation therefore when two `+=` operations are executed concurrently updates
17
- # may be lost. Use `#concat` instead.
13
+ # `Concurrent::Array`. It reads array `a`, then it creates new `Concurrent::Array`
14
+ # which is concatenation of `a` and `b`, then it writes the concatenation to `a`.
15
+ # The read and write are independent operations they do not form a single atomic
16
+ # operation therefore when two `+=` operations are executed concurrently updates
17
+ # may be lost. Use `#concat` instead.
18
18
  #
19
- # @see http://ruby-doc.org/core-2.2.0/Array.html Ruby standard library `Array`
19
+ # @see http://ruby-doc.org/core/Array.html Ruby standard library `Array`
20
20
 
21
21
  # @!macro internal_implementation_note
22
22
  ArrayImplementation = case
@@ -58,26 +58,6 @@ module Concurrent
58
58
  # end
59
59
  # ```
60
60
  #
61
- # When defining a constructor it is critical that the first line be a call to
62
- # `super` with no arguments. The `super` method initializes the background
63
- # thread and other asynchronous components.
64
- #
65
- # ```
66
- # class BackgroundLogger
67
- # include Concurrent::Async
68
- #
69
- # def initialize(level)
70
- # super()
71
- # @logger = Logger.new(STDOUT)
72
- # @logger.level = level
73
- # end
74
- #
75
- # def info(msg)
76
- # @logger.info(msg)
77
- # end
78
- # end
79
- # ```
80
- #
81
61
  # Mixing this module into a class provides each object two proxy methods:
82
62
  # `async` and `await`. These methods are thread safe with respect to the
83
63
  # enclosing object. The former proxy allows methods to be called
@@ -309,6 +289,7 @@ module Concurrent
309
289
  @delegate = delegate
310
290
  @queue = []
311
291
  @executor = Concurrent.global_io_executor
292
+ @ruby_pid = $$
312
293
  end
313
294
 
314
295
  # Delegates method calls to the wrapped object.
@@ -326,6 +307,7 @@ module Concurrent
326
307
 
327
308
  ivar = Concurrent::IVar.new
328
309
  synchronize do
310
+ reset_if_forked
329
311
  @queue.push [ivar, method, args, block]
330
312
  @executor.post { perform } if @queue.length == 1
331
313
  end
@@ -361,6 +343,13 @@ module Concurrent
361
343
  end
362
344
  end
363
345
  end
346
+
347
+ def reset_if_forked
348
+ if $$ != @ruby_pid
349
+ @queue.clear
350
+ @ruby_pid = $$
351
+ end
352
+ end
364
353
  end
365
354
  private_constant :AsyncDelegator
366
355