concurrent-ruby 1.0.5 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +65 -0
  3. data/Gemfile +39 -0
  4. data/{LICENSE.txt → LICENSE.md} +2 -0
  5. data/README.md +207 -105
  6. data/Rakefile +314 -0
  7. data/ext/concurrent-ruby/ConcurrentRubyService.java +17 -0
  8. data/ext/concurrent-ruby/com/concurrent_ruby/ext/AtomicReferenceLibrary.java +175 -0
  9. data/ext/concurrent-ruby/com/concurrent_ruby/ext/JRubyMapBackendLibrary.java +248 -0
  10. data/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaAtomicBooleanLibrary.java +93 -0
  11. data/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaAtomicFixnumLibrary.java +113 -0
  12. data/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaSemaphoreLibrary.java +159 -0
  13. data/ext/concurrent-ruby/com/concurrent_ruby/ext/SynchronizationLibrary.java +306 -0
  14. data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMap.java +31 -0
  15. data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMapV8.java +3863 -0
  16. data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/LongAdder.java +203 -0
  17. data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/Striped64.java +342 -0
  18. data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/ConcurrentHashMapV8.java +3800 -0
  19. data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/LongAdder.java +204 -0
  20. data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/Striped64.java +291 -0
  21. data/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166y/ThreadLocalRandom.java +199 -0
  22. data/lib/concurrent/agent.rb +7 -7
  23. data/lib/concurrent/array.rb +59 -32
  24. data/lib/concurrent/async.rb +4 -4
  25. data/lib/concurrent/atom.rb +9 -9
  26. data/lib/concurrent/atomic/atomic_boolean.rb +24 -20
  27. data/lib/concurrent/atomic/atomic_fixnum.rb +27 -23
  28. data/lib/concurrent/atomic/atomic_markable_reference.rb +164 -0
  29. data/lib/concurrent/atomic/atomic_reference.rb +185 -32
  30. data/lib/concurrent/atomic/count_down_latch.rb +6 -6
  31. data/lib/concurrent/atomic/cyclic_barrier.rb +1 -1
  32. data/lib/concurrent/atomic/event.rb +1 -1
  33. data/lib/concurrent/atomic/java_count_down_latch.rb +9 -6
  34. data/lib/concurrent/atomic/mutex_atomic_boolean.rb +2 -0
  35. data/lib/concurrent/atomic/mutex_count_down_latch.rb +1 -0
  36. data/lib/concurrent/atomic/read_write_lock.rb +2 -1
  37. data/lib/concurrent/atomic/reentrant_read_write_lock.rb +3 -1
  38. data/lib/concurrent/atomic/semaphore.rb +8 -8
  39. data/lib/concurrent/atomic/thread_local_var.rb +7 -7
  40. data/lib/concurrent/atomic_reference/mutex_atomic.rb +3 -8
  41. data/lib/concurrent/atomic_reference/numeric_cas_wrapper.rb +1 -1
  42. data/lib/concurrent/atomics.rb +0 -43
  43. data/lib/concurrent/collection/lock_free_stack.rb +158 -0
  44. data/lib/concurrent/collection/map/atomic_reference_map_backend.rb +3 -3
  45. data/lib/concurrent/collection/map/non_concurrent_map_backend.rb +1 -2
  46. data/lib/concurrent/collection/non_concurrent_priority_queue.rb +29 -29
  47. data/lib/concurrent/concern/dereferenceable.rb +1 -1
  48. data/lib/concurrent/concern/logging.rb +6 -1
  49. data/lib/concurrent/concern/observable.rb +7 -7
  50. data/lib/concurrent/concurrent_ruby.jar +0 -0
  51. data/lib/concurrent/configuration.rb +1 -6
  52. data/lib/concurrent/constants.rb +1 -1
  53. data/lib/concurrent/dataflow.rb +2 -1
  54. data/lib/concurrent/delay.rb +9 -7
  55. data/lib/concurrent/exchanger.rb +21 -25
  56. data/lib/concurrent/executor/abstract_executor_service.rb +2 -2
  57. data/lib/concurrent/executor/cached_thread_pool.rb +1 -1
  58. data/lib/concurrent/executor/executor_service.rb +15 -15
  59. data/lib/concurrent/executor/fixed_thread_pool.rb +18 -18
  60. data/lib/concurrent/executor/java_thread_pool_executor.rb +10 -7
  61. data/lib/concurrent/executor/single_thread_executor.rb +2 -2
  62. data/lib/concurrent/executor/thread_pool_executor.rb +6 -6
  63. data/lib/concurrent/executor/timer_set.rb +1 -1
  64. data/lib/concurrent/future.rb +4 -1
  65. data/lib/concurrent/hash.rb +53 -30
  66. data/lib/concurrent/ivar.rb +5 -6
  67. data/lib/concurrent/map.rb +178 -81
  68. data/lib/concurrent/maybe.rb +1 -1
  69. data/lib/concurrent/mutable_struct.rb +15 -14
  70. data/lib/concurrent/mvar.rb +2 -2
  71. data/lib/concurrent/promise.rb +53 -21
  72. data/lib/concurrent/promises.rb +1936 -0
  73. data/lib/concurrent/re_include.rb +58 -0
  74. data/lib/concurrent/set.rb +66 -0
  75. data/lib/concurrent/settable_struct.rb +1 -0
  76. data/lib/concurrent/synchronization/abstract_lockable_object.rb +5 -5
  77. data/lib/concurrent/synchronization/abstract_struct.rb +6 -4
  78. data/lib/concurrent/synchronization/lockable_object.rb +6 -6
  79. data/lib/concurrent/synchronization/{mri_lockable_object.rb → mutex_lockable_object.rb} +19 -14
  80. data/lib/concurrent/synchronization/object.rb +8 -4
  81. data/lib/concurrent/synchronization/truffleruby_object.rb +46 -0
  82. data/lib/concurrent/synchronization/volatile.rb +11 -9
  83. data/lib/concurrent/synchronization.rb +4 -5
  84. data/lib/concurrent/thread_safe/util/data_structures.rb +63 -0
  85. data/lib/concurrent/thread_safe/util/striped64.rb +9 -4
  86. data/lib/concurrent/timer_task.rb +5 -2
  87. data/lib/concurrent/tuple.rb +1 -1
  88. data/lib/concurrent/tvar.rb +2 -2
  89. data/lib/concurrent/utility/193.rb +17 -0
  90. data/lib/concurrent/utility/at_exit.rb +1 -1
  91. data/lib/concurrent/utility/engine.rb +4 -4
  92. data/lib/concurrent/utility/monotonic_time.rb +3 -3
  93. data/lib/concurrent/utility/native_extension_loader.rb +31 -33
  94. data/lib/concurrent/utility/processor_counter.rb +0 -2
  95. data/lib/concurrent/version.rb +2 -2
  96. data/lib/concurrent-ruby.rb +1 -0
  97. data/lib/concurrent.rb +26 -20
  98. metadata +33 -18
  99. data/lib/concurrent/atomic_reference/concurrent_update_error.rb +0 -8
  100. data/lib/concurrent/atomic_reference/direct_update.rb +0 -81
  101. data/lib/concurrent/atomic_reference/jruby+truffle.rb +0 -2
  102. data/lib/concurrent/atomic_reference/jruby.rb +0 -16
  103. data/lib/concurrent/atomic_reference/rbx.rb +0 -22
  104. data/lib/concurrent/atomic_reference/ruby.rb +0 -32
  105. data/lib/concurrent/edge.rb +0 -26
  106. data/lib/concurrent/lazy_register.rb +0 -81
  107. data/lib/concurrent/synchronization/truffle_lockable_object.rb +0 -9
  108. data/lib/concurrent/synchronization/truffle_object.rb +0 -31
  109. data/lib/concurrent/thread_safe/util/array_hash_rbx.rb +0 -30
@@ -8,7 +8,7 @@ module Concurrent
8
8
  end
9
9
 
10
10
  def on_jruby_9000?
11
- on_jruby? && ruby_version(:>=, 9, 0, 0, JRUBY_VERSION)
11
+ on_jruby? && ruby_version(JRUBY_VERSION, :>=, 9, 0, 0)
12
12
  end
13
13
 
14
14
  def on_cruby?
@@ -19,8 +19,8 @@ module Concurrent
19
19
  ruby_engine == 'rbx'
20
20
  end
21
21
 
22
- def on_truffle?
23
- ruby_engine == 'jruby+truffle'
22
+ def on_truffleruby?
23
+ ruby_engine == 'truffleruby'
24
24
  end
25
25
 
26
26
  def on_windows?
@@ -39,7 +39,7 @@ module Concurrent
39
39
  defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
40
40
  end
41
41
 
42
- def ruby_version(comparison, major, minor, patch, version = RUBY_VERSION)
42
+ def ruby_version(version = RUBY_VERSION, comparison, major, minor, patch)
43
43
  result = (version.split('.').map(&:to_i) <=> [major, minor, patch])
44
44
  comparisons = { :== => [0],
45
45
  :>= => [1, 0],
@@ -42,12 +42,12 @@ module Concurrent
42
42
  GLOBAL_MONOTONIC_CLOCK = class_definition.new
43
43
  private_constant :GLOBAL_MONOTONIC_CLOCK
44
44
 
45
- # @!macro [attach] monotonic_get_time
45
+ # @!macro monotonic_get_time
46
46
  #
47
47
  # Returns the current time a tracked by the application monotonic clock.
48
48
  #
49
- # @return [Float] The current monotonic time when `since` not given else
50
- # the elapsed monotonic time between `since` and the current time
49
+ # @return [Float] The current monotonic time since some unspecified
50
+ # starting point
51
51
  #
52
52
  # @!macro monotonic_clock_warning
53
53
  def monotonic_time
@@ -12,19 +12,11 @@ module Concurrent
12
12
  end
13
13
 
14
14
  def c_extensions_loaded?
15
- @c_extensions_loaded ||= false
15
+ defined?(@c_extensions_loaded) && @c_extensions_loaded
16
16
  end
17
17
 
18
18
  def java_extensions_loaded?
19
- @java_extensions_loaded ||= false
20
- end
21
-
22
- def set_c_extensions_loaded
23
- @c_extensions_loaded = true
24
- end
25
-
26
- def set_java_extensions_loaded
27
- @java_extensions_loaded = true
19
+ defined?(@java_extensions_loaded) && @java_extensions_loaded
28
20
  end
29
21
 
30
22
  def load_native_extensions
@@ -33,37 +25,43 @@ module Concurrent
33
25
  end
34
26
 
35
27
  if Concurrent.on_cruby? && !c_extensions_loaded?
36
- tries = [
37
- lambda do
38
- require 'concurrent/extension'
39
- set_c_extensions_loaded
40
- end,
41
- lambda do
42
- # may be a Windows cross-compiled native gem
43
- require "concurrent/#{RUBY_VERSION[0..2]}/extension"
44
- set_c_extensions_loaded
45
- end]
46
-
47
- tries.each do |try|
48
- begin
49
- try.call
50
- break
51
- rescue LoadError
52
- next
53
- end
54
- end
28
+ ['concurrent/concurrent_ruby_ext',
29
+ "concurrent/#{RUBY_VERSION[0..2]}/concurrent_ruby_ext"
30
+ ].each { |p| try_load_c_extension p }
55
31
  end
56
32
 
57
33
  if Concurrent.on_jruby? && !java_extensions_loaded?
58
34
  begin
59
- require 'concurrent_ruby_ext'
35
+ require 'concurrent/concurrent_ruby.jar'
60
36
  set_java_extensions_loaded
61
- rescue LoadError
62
- # move on with pure-Ruby implementations
63
- raise 'On JRuby but Java extensions failed to load.'
37
+ rescue LoadError => e
38
+ raise e, "Java extensions are required for JRuby.\n" + e.message, e.backtrace
64
39
  end
65
40
  end
66
41
  end
42
+
43
+ private
44
+
45
+ def set_c_extensions_loaded
46
+ @c_extensions_loaded = true
47
+ end
48
+
49
+ def set_java_extensions_loaded
50
+ @java_extensions_loaded = true
51
+ end
52
+
53
+ def try_load_c_extension(path)
54
+ require path
55
+ set_c_extensions_loaded
56
+ rescue LoadError => e
57
+ if e.path == path
58
+ # move on with pure-Ruby implementations
59
+ # TODO (pitr-ch 12-Jul-2018): warning on verbose?
60
+ else
61
+ raise e
62
+ end
63
+ end
64
+
67
65
  end
68
66
  end
69
67
 
@@ -76,8 +76,6 @@ module Concurrent
76
76
  def compute_processor_count
77
77
  if Concurrent.on_jruby?
78
78
  java.lang.Runtime.getRuntime.availableProcessors
79
- elsif Concurrent.on_truffle?
80
- Truffle::Primitive.logical_processors
81
79
  else
82
80
  os_name = RbConfig::CONFIG["target_os"]
83
81
  if os_name =~ /mingw|mswin/
@@ -1,4 +1,4 @@
1
1
  module Concurrent
2
- VERSION = '1.0.5'
3
- EDGE_VERSION = '0.3.1'
2
+ VERSION = '1.1.1'
3
+ EDGE_VERSION = '0.4.1'
4
4
  end
@@ -0,0 +1 @@
1
+ require_relative "./concurrent"
data/lib/concurrent.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'concurrent/utility/193'
2
+
1
3
  require 'concurrent/version'
2
4
  require 'concurrent/constants'
3
5
  require 'concurrent/errors'
@@ -7,11 +9,13 @@ require 'concurrent/atomics'
7
9
  require 'concurrent/executors'
8
10
  require 'concurrent/synchronization'
9
11
 
12
+ require 'concurrent/atomic/atomic_markable_reference'
10
13
  require 'concurrent/atomic/atomic_reference'
11
14
  require 'concurrent/agent'
12
15
  require 'concurrent/atom'
13
16
  require 'concurrent/array'
14
17
  require 'concurrent/hash'
18
+ require 'concurrent/set'
15
19
  require 'concurrent/map'
16
20
  require 'concurrent/tuple'
17
21
  require 'concurrent/async'
@@ -29,20 +33,21 @@ require 'concurrent/scheduled_task'
29
33
  require 'concurrent/settable_struct'
30
34
  require 'concurrent/timer_task'
31
35
  require 'concurrent/tvar'
36
+ require 'concurrent/promises'
32
37
 
33
38
  require 'concurrent/thread_safe/synchronized_delegator'
34
39
  require 'concurrent/thread_safe/util'
35
40
 
36
41
  require 'concurrent/options'
37
42
 
38
- # @!macro [new] internal_implementation_note
43
+ # @!macro internal_implementation_note
39
44
  #
40
45
  # @note **Private Implementation:** This abstraction is a private, internal
41
46
  # implementation detail. It should never be used directly.
42
47
 
43
- # @!macro [new] monotonic_clock_warning
48
+ # @!macro monotonic_clock_warning
44
49
  #
45
- # @note Time calculations one all platforms and languages are sensitive to
50
+ # @note Time calculations on all platforms and languages are sensitive to
46
51
  # changes to the system clock. To alleviate the potential problems
47
52
  # associated with changing the system clock while an application is running,
48
53
  # most modern operating systems provide a monotonic clock that operates
@@ -58,7 +63,7 @@ require 'concurrent/options'
58
63
  #
59
64
  # @see http://linux.die.net/man/3/clock_gettime Linux clock_gettime(3)
60
65
 
61
- # @!macro [new] copy_options
66
+ # @!macro copy_options
62
67
  #
63
68
  # ## Copy Options
64
69
  #
@@ -94,7 +99,7 @@ require 'concurrent/options'
94
99
  # as close to the behavior of a "pure" functional language (like Erlang, Clojure,
95
100
  # or Haskell) as we are likely to get in Ruby.
96
101
 
97
- # @!macro [attach] deref_options
102
+ # @!macro deref_options
98
103
  #
99
104
  # @option opts [Boolean] :dup_on_deref (false) Call `#dup` before
100
105
  # returning the data from {#value}
@@ -104,27 +109,28 @@ require 'concurrent/options'
104
109
  # method, call the given proc passing the internal value as the sole
105
110
  # argument then return the new value returned from the proc.
106
111
 
107
- # @!macro [attach] executor_and_deref_options
112
+ # @!macro executor_and_deref_options
108
113
  #
109
114
  # @param [Hash] opts the options used to define the behavior at update and deref
110
115
  # and to specify the executor on which to perform actions
111
116
  # @option opts [Executor] :executor when set use the given `Executor` instance.
112
- # Three special values are also supported: `:task` returns the global task pool,
113
- # `:operation` returns the global operation pool, and `:immediate` returns a new
114
- # `ImmediateExecutor` object.
117
+ # Three special values are also supported: `:io` returns the global pool for
118
+ # long, blocking (IO) tasks, `:fast` returns the global pool for short, fast
119
+ # operations, and `:immediate` returns the global `ImmediateExecutor` object.
115
120
  # @!macro deref_options
116
121
 
117
- # Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell,
118
- # F#, C#, Java, and classic concurrency patterns.
119
- #
120
- # The design goals of this gem are:
122
+ # @!macro warn.edge
123
+ # @api Edge
124
+ # @note **Edge Features** are under active development and may change frequently.
121
125
  #
122
- # * Stay true to the spirit of the languages providing inspiration
123
- # * But implement in a way that makes sense for Ruby
124
- # * Keep the semantics as idiomatic Ruby as possible
125
- # * Support features that make sense in Ruby
126
- # * Exclude features that don't make sense in Ruby
127
- # * Be small, lean, and loosely coupled
128
- module Concurrent
126
+ # - Deprecations are not added before incompatible changes.
127
+ # - Edge version: _major_ is always 0, _minor_ bump means incompatible change,
128
+ # _patch_ bump means compatible change.
129
+ # - Edge features may also lack tests and documentation.
130
+ # - Features developed in `concurrent-ruby-edge` are expected to move
131
+ # to `concurrent-ruby` when finalised.
129
132
 
133
+
134
+ # {include:file:README.md}
135
+ module Concurrent
130
136
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concurrent-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry D'Antonio
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-02-26 00:00:00.000000000 Z
13
+ date: 2018-11-05 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: |
16
16
  Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.
@@ -20,12 +20,30 @@ executables: []
20
20
  extensions: []
21
21
  extra_rdoc_files:
22
22
  - README.md
23
- - LICENSE.txt
23
+ - LICENSE.md
24
24
  - CHANGELOG.md
25
25
  files:
26
26
  - CHANGELOG.md
27
- - LICENSE.txt
27
+ - Gemfile
28
+ - LICENSE.md
28
29
  - README.md
30
+ - Rakefile
31
+ - ext/concurrent-ruby/ConcurrentRubyService.java
32
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/AtomicReferenceLibrary.java
33
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/JRubyMapBackendLibrary.java
34
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/JavaAtomicBooleanLibrary.java
35
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/JavaAtomicFixnumLibrary.java
36
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/JavaSemaphoreLibrary.java
37
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/SynchronizationLibrary.java
38
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMap.java
39
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMapV8.java
40
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/LongAdder.java
41
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/Striped64.java
42
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/ConcurrentHashMapV8.java
43
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/LongAdder.java
44
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/Striped64.java
45
+ - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166y/ThreadLocalRandom.java
46
+ - lib/concurrent-ruby.rb
29
47
  - lib/concurrent.rb
30
48
  - lib/concurrent/agent.rb
31
49
  - lib/concurrent/array.rb
@@ -34,6 +52,7 @@ files:
34
52
  - lib/concurrent/atomic/abstract_thread_local_var.rb
35
53
  - lib/concurrent/atomic/atomic_boolean.rb
36
54
  - lib/concurrent/atomic/atomic_fixnum.rb
55
+ - lib/concurrent/atomic/atomic_markable_reference.rb
37
56
  - lib/concurrent/atomic/atomic_reference.rb
38
57
  - lib/concurrent/atomic/count_down_latch.rb
39
58
  - lib/concurrent/atomic/cyclic_barrier.rb
@@ -49,18 +68,13 @@ files:
49
68
  - lib/concurrent/atomic/ruby_thread_local_var.rb
50
69
  - lib/concurrent/atomic/semaphore.rb
51
70
  - lib/concurrent/atomic/thread_local_var.rb
52
- - lib/concurrent/atomic_reference/concurrent_update_error.rb
53
- - lib/concurrent/atomic_reference/direct_update.rb
54
- - lib/concurrent/atomic_reference/jruby+truffle.rb
55
- - lib/concurrent/atomic_reference/jruby.rb
56
71
  - lib/concurrent/atomic_reference/mutex_atomic.rb
57
72
  - lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
58
- - lib/concurrent/atomic_reference/rbx.rb
59
- - lib/concurrent/atomic_reference/ruby.rb
60
73
  - lib/concurrent/atomics.rb
61
74
  - lib/concurrent/collection/copy_on_notify_observer_set.rb
62
75
  - lib/concurrent/collection/copy_on_write_observer_set.rb
63
76
  - lib/concurrent/collection/java_non_concurrent_priority_queue.rb
77
+ - lib/concurrent/collection/lock_free_stack.rb
64
78
  - lib/concurrent/collection/map/atomic_reference_map_backend.rb
65
79
  - lib/concurrent/collection/map/mri_map_backend.rb
66
80
  - lib/concurrent/collection/map/non_concurrent_map_backend.rb
@@ -72,11 +86,11 @@ files:
72
86
  - lib/concurrent/concern/logging.rb
73
87
  - lib/concurrent/concern/obligation.rb
74
88
  - lib/concurrent/concern/observable.rb
89
+ - lib/concurrent/concurrent_ruby.jar
75
90
  - lib/concurrent/configuration.rb
76
91
  - lib/concurrent/constants.rb
77
92
  - lib/concurrent/dataflow.rb
78
93
  - lib/concurrent/delay.rb
79
- - lib/concurrent/edge.rb
80
94
  - lib/concurrent/errors.rb
81
95
  - lib/concurrent/exchanger.rb
82
96
  - lib/concurrent/executor/abstract_executor_service.rb
@@ -104,14 +118,16 @@ files:
104
118
  - lib/concurrent/hash.rb
105
119
  - lib/concurrent/immutable_struct.rb
106
120
  - lib/concurrent/ivar.rb
107
- - lib/concurrent/lazy_register.rb
108
121
  - lib/concurrent/map.rb
109
122
  - lib/concurrent/maybe.rb
110
123
  - lib/concurrent/mutable_struct.rb
111
124
  - lib/concurrent/mvar.rb
112
125
  - lib/concurrent/options.rb
113
126
  - lib/concurrent/promise.rb
127
+ - lib/concurrent/promises.rb
128
+ - lib/concurrent/re_include.rb
114
129
  - lib/concurrent/scheduled_task.rb
130
+ - lib/concurrent/set.rb
115
131
  - lib/concurrent/settable_struct.rb
116
132
  - lib/concurrent/synchronization.rb
117
133
  - lib/concurrent/synchronization/abstract_lockable_object.rb
@@ -122,19 +138,18 @@ files:
122
138
  - lib/concurrent/synchronization/jruby_object.rb
123
139
  - lib/concurrent/synchronization/lock.rb
124
140
  - lib/concurrent/synchronization/lockable_object.rb
125
- - lib/concurrent/synchronization/mri_lockable_object.rb
126
141
  - lib/concurrent/synchronization/mri_object.rb
142
+ - lib/concurrent/synchronization/mutex_lockable_object.rb
127
143
  - lib/concurrent/synchronization/object.rb
128
144
  - lib/concurrent/synchronization/rbx_lockable_object.rb
129
145
  - lib/concurrent/synchronization/rbx_object.rb
130
- - lib/concurrent/synchronization/truffle_lockable_object.rb
131
- - lib/concurrent/synchronization/truffle_object.rb
146
+ - lib/concurrent/synchronization/truffleruby_object.rb
132
147
  - lib/concurrent/synchronization/volatile.rb
133
148
  - lib/concurrent/thread_safe/synchronized_delegator.rb
134
149
  - lib/concurrent/thread_safe/util.rb
135
150
  - lib/concurrent/thread_safe/util/adder.rb
136
- - lib/concurrent/thread_safe/util/array_hash_rbx.rb
137
151
  - lib/concurrent/thread_safe/util/cheap_lockable.rb
152
+ - lib/concurrent/thread_safe/util/data_structures.rb
138
153
  - lib/concurrent/thread_safe/util/power_of_two_tuple.rb
139
154
  - lib/concurrent/thread_safe/util/striped64.rb
140
155
  - lib/concurrent/thread_safe/util/volatile.rb
@@ -142,6 +157,7 @@ files:
142
157
  - lib/concurrent/timer_task.rb
143
158
  - lib/concurrent/tuple.rb
144
159
  - lib/concurrent/tvar.rb
160
+ - lib/concurrent/utility/193.rb
145
161
  - lib/concurrent/utility/at_exit.rb
146
162
  - lib/concurrent/utility/engine.rb
147
163
  - lib/concurrent/utility/monotonic_time.rb
@@ -169,10 +185,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
185
  version: '0'
170
186
  requirements: []
171
187
  rubyforge_project:
172
- rubygems_version: 2.6.8
188
+ rubygems_version: 2.7.3
173
189
  signing_key:
174
190
  specification_version: 4
175
191
  summary: Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell,
176
192
  F#, C#, Java, and classic concurrency patterns.
177
193
  test_files: []
178
- has_rdoc:
@@ -1,8 +0,0 @@
1
- module Concurrent
2
-
3
- # @!macro atomic_reference
4
- class ConcurrentUpdateError < ThreadError
5
- # frozen pre-allocated backtrace to speed ConcurrentUpdateError
6
- CONC_UP_ERR_BACKTRACE = ['backtrace elided; set verbose to enable'].freeze
7
- end
8
- end
@@ -1,81 +0,0 @@
1
- require 'concurrent/atomic_reference/concurrent_update_error'
2
-
3
- module Concurrent
4
-
5
- # Define update methods that use direct paths
6
- #
7
- # @!visibility private
8
- # @!macro internal_implementation_note
9
- module AtomicDirectUpdate
10
-
11
- # @!macro [attach] atomic_reference_method_update
12
- #
13
- # Pass the current value to the given block, replacing it
14
- # with the block's result. May retry if the value changes
15
- # during the block's execution.
16
- #
17
- # @yield [Object] Calculate a new value for the atomic reference using
18
- # given (old) value
19
- # @yieldparam [Object] old_value the starting value of the atomic reference
20
- #
21
- # @return [Object] the new value
22
- def update
23
- true until compare_and_set(old_value = get, new_value = yield(old_value))
24
- new_value
25
- end
26
-
27
- # @!macro [attach] atomic_reference_method_try_update
28
- #
29
- # Pass the current value to the given block, replacing it
30
- # with the block's result. Return nil if the update fails.
31
- #
32
- # @yield [Object] Calculate a new value for the atomic reference using
33
- # given (old) value
34
- # @yieldparam [Object] old_value the starting value of the atomic reference
35
- #
36
- # @note This method was altered to avoid raising an exception by default.
37
- # Instead, this method now returns `nil` in case of failure. For more info,
38
- # please see: https://github.com/ruby-concurrency/concurrent-ruby/pull/336
39
- #
40
- # @return [Object] the new value, or nil if update failed
41
- def try_update
42
- old_value = get
43
- new_value = yield old_value
44
-
45
- return unless compare_and_set old_value, new_value
46
-
47
- new_value
48
- end
49
-
50
- # @!macro [attach] atomic_reference_method_try_update!
51
- #
52
- # Pass the current value to the given block, replacing it
53
- # with the block's result. Raise an exception if the update
54
- # fails.
55
- #
56
- # @yield [Object] Calculate a new value for the atomic reference using
57
- # given (old) value
58
- # @yieldparam [Object] old_value the starting value of the atomic reference
59
- #
60
- # @note This behavior mimics the behavior of the original
61
- # `AtomicReference#try_update` API. The reason this was changed was to
62
- # avoid raising exceptions (which are inherently slow) by default. For more
63
- # info: https://github.com/ruby-concurrency/concurrent-ruby/pull/336
64
- #
65
- # @return [Object] the new value
66
- #
67
- # @raise [Concurrent::ConcurrentUpdateError] if the update fails
68
- def try_update!
69
- old_value = get
70
- new_value = yield old_value
71
- unless compare_and_set(old_value, new_value)
72
- if $VERBOSE
73
- raise ConcurrentUpdateError, "Update failed"
74
- else
75
- raise ConcurrentUpdateError, "Update failed", ConcurrentUpdateError::CONC_UP_ERR_BACKTRACE
76
- end
77
- end
78
- new_value
79
- end
80
- end
81
- end
@@ -1,2 +0,0 @@
1
- require 'atomic'
2
- require 'concurrent/atomic_reference/rbx'
@@ -1,16 +0,0 @@
1
- require 'concurrent/synchronization'
2
-
3
- if defined?(Concurrent::JavaAtomicReference)
4
- require 'concurrent/atomic_reference/direct_update'
5
-
6
- module Concurrent
7
-
8
- # @!macro atomic_reference
9
- #
10
- # @!visibility private
11
- # @!macro internal_implementation_note
12
- class JavaAtomicReference
13
- include Concurrent::AtomicDirectUpdate
14
- end
15
- end
16
- end
@@ -1,22 +0,0 @@
1
- require 'concurrent/atomic_reference/direct_update'
2
- require 'concurrent/atomic_reference/numeric_cas_wrapper'
3
-
4
- module Concurrent
5
-
6
- # @!macro atomic_reference
7
- #
8
- # @note Extends `Rubinius::AtomicReference` version adding aliases
9
- # and numeric logic.
10
- #
11
- # @!visibility private
12
- # @!macro internal_implementation_note
13
- class RbxAtomicReference < Rubinius::AtomicReference
14
- alias _compare_and_set compare_and_set
15
- include Concurrent::AtomicDirectUpdate
16
- include Concurrent::AtomicNumericCompareAndSetWrapper
17
-
18
- alias_method :value, :get
19
- alias_method :value=, :set
20
- alias_method :swap, :get_and_set
21
- end
22
- end
@@ -1,32 +0,0 @@
1
- if defined? Concurrent::CAtomicReference
2
- require 'concurrent/synchronization'
3
- require 'concurrent/atomic_reference/direct_update'
4
- require 'concurrent/atomic_reference/numeric_cas_wrapper'
5
-
6
- module Concurrent
7
-
8
- # @!macro atomic_reference
9
- #
10
- # @!visibility private
11
- # @!macro internal_implementation_note
12
- class CAtomicReference
13
- include Concurrent::AtomicDirectUpdate
14
- include Concurrent::AtomicNumericCompareAndSetWrapper
15
-
16
- # @!method initialize
17
- # @!macro atomic_reference_method_initialize
18
-
19
- # @!method get
20
- # @!macro atomic_reference_method_get
21
-
22
- # @!method set
23
- # @!macro atomic_reference_method_set
24
-
25
- # @!method get_and_set
26
- # @!macro atomic_reference_method_get_and_set
27
-
28
- # @!method _compare_and_set
29
- # @!macro atomic_reference_method_compare_and_set
30
- end
31
- end
32
- end
@@ -1,26 +0,0 @@
1
- module Concurrent
2
-
3
- # A submodule for unstable, highly experimental features that are likely to
4
- # change often and which may never become part of the core gem. Also for
5
- # new, experimental version of abstractions already in the core gem.
6
- #
7
- # Most new features should start in this module, clearly indicating the
8
- # experimental and unstable nature of the feature. Once a feature becomes
9
- # more stable and is a candidate for inclusion in the core gem it should
10
- # be moved up to the `Concurrent` module, where it would reside once merged
11
- # into the core gem.
12
- #
13
- # The only exception to this is for features which *replace* features from
14
- # the core gem in ways that are breaking and not backward compatible. These
15
- # features should remain in this module until merged into the core gem. This
16
- # will prevent namespace collisions.
17
- #
18
- # @!macro [attach] edge_warning
19
- # @api Edge
20
- # @note **Edge Feature:** Edge features are under active development and may change frequently. They are expected not to
21
- # keep backward compatibility (there may also lack tests and documentation). Semantic versions will
22
- # be obeyed though. Features developed in `concurrent-ruby-edge` are expected to move
23
- # to `concurrent-ruby` when final.
24
- module Edge
25
- end
26
- end