concurrent-ruby 1.1.5 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +84 -1
  3. data/Gemfile +5 -10
  4. data/{LICENSE.md → LICENSE.txt} +18 -20
  5. data/README.md +55 -31
  6. data/Rakefile +84 -92
  7. data/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaAtomicFixnumLibrary.java +0 -0
  8. data/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaSemaphoreLibrary.java +52 -22
  9. data/ext/concurrent-ruby/com/concurrent_ruby/ext/SynchronizationLibrary.java +10 -25
  10. data/lib/{concurrent → concurrent-ruby/concurrent}/agent.rb +2 -1
  11. data/lib/{concurrent → concurrent-ruby/concurrent}/array.rb +6 -16
  12. data/lib/{concurrent → concurrent-ruby/concurrent}/async.rb +10 -20
  13. data/lib/{concurrent → concurrent-ruby/concurrent}/atom.rb +2 -2
  14. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_boolean.rb +7 -6
  15. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_fixnum.rb +5 -4
  16. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/atomic_markable_reference.rb +3 -0
  17. data/lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb +135 -0
  18. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/cyclic_barrier.rb +1 -1
  19. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/event.rb +3 -3
  20. data/lib/concurrent-ruby/concurrent/atomic/fiber_local_var.rb +109 -0
  21. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/java_count_down_latch.rb +1 -0
  22. data/lib/concurrent-ruby/concurrent/atomic/locals.rb +189 -0
  23. data/lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb +28 -0
  24. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_atomic_boolean.rb +11 -5
  25. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_atomic_fixnum.rb +11 -5
  26. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_count_down_latch.rb +1 -1
  27. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/mutex_semaphore.rb +19 -3
  28. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/read_write_lock.rb +2 -1
  29. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/reentrant_read_write_lock.rb +9 -9
  30. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/semaphore.rb +32 -14
  31. data/lib/concurrent-ruby/concurrent/atomic/thread_local_var.rb +111 -0
  32. data/lib/concurrent-ruby/concurrent/atomic_reference/atomic_direct_update.rb +37 -0
  33. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic_reference/mutex_atomic.rb +15 -4
  34. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/copy_on_notify_observer_set.rb +1 -1
  35. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/copy_on_write_observer_set.rb +1 -1
  36. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/lock_free_stack.rb +2 -0
  37. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/mri_map_backend.rb +3 -3
  38. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/non_concurrent_map_backend.rb +16 -8
  39. data/lib/concurrent-ruby/concurrent/collection/map/truffleruby_map_backend.rb +14 -0
  40. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/ruby_non_concurrent_priority_queue.rb +11 -1
  41. data/lib/{concurrent → concurrent-ruby/concurrent}/concern/dereferenceable.rb +2 -2
  42. data/lib/concurrent-ruby/concurrent/concern/logging.rb +116 -0
  43. data/lib/concurrent-ruby/concurrent/concurrent_ruby.jar +0 -0
  44. data/lib/concurrent-ruby/concurrent/configuration.rb +105 -0
  45. data/lib/{concurrent → concurrent-ruby/concurrent}/delay.rb +2 -2
  46. data/lib/{concurrent → concurrent-ruby/concurrent}/errors.rb +5 -0
  47. data/lib/{concurrent → concurrent-ruby/concurrent}/exchanger.rb +1 -0
  48. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/abstract_executor_service.rb +34 -37
  49. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/cached_thread_pool.rb +4 -4
  50. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/executor_service.rb +2 -2
  51. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/fixed_thread_pool.rb +29 -15
  52. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/java_executor_service.rb +21 -9
  53. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/java_single_thread_executor.rb +4 -3
  54. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/java_thread_pool_executor.rb +19 -2
  55. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/ruby_executor_service.rb +10 -6
  56. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/ruby_single_thread_executor.rb +0 -1
  57. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/ruby_thread_pool_executor.rb +46 -42
  58. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/safe_task_executor.rb +6 -6
  59. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/serialized_execution.rb +1 -1
  60. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/simple_executor_service.rb +5 -2
  61. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/single_thread_executor.rb +1 -0
  62. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/thread_pool_executor.rb +2 -1
  63. data/lib/{concurrent → concurrent-ruby/concurrent}/executor/timer_set.rb +0 -1
  64. data/lib/{concurrent → concurrent-ruby/concurrent}/hash.rb +1 -10
  65. data/lib/{concurrent → concurrent-ruby/concurrent}/immutable_struct.rb +10 -2
  66. data/lib/{concurrent → concurrent-ruby/concurrent}/ivar.rb +2 -1
  67. data/lib/{concurrent → concurrent-ruby/concurrent}/map.rb +44 -31
  68. data/lib/{concurrent → concurrent-ruby/concurrent}/maybe.rb +1 -1
  69. data/lib/{concurrent → concurrent-ruby/concurrent}/mutable_struct.rb +13 -3
  70. data/lib/{concurrent → concurrent-ruby/concurrent}/mvar.rb +1 -1
  71. data/lib/{concurrent → concurrent-ruby/concurrent}/promise.rb +2 -1
  72. data/lib/{concurrent → concurrent-ruby/concurrent}/promises.rb +7 -6
  73. data/lib/{concurrent → concurrent-ruby/concurrent}/re_include.rb +2 -0
  74. data/lib/{concurrent → concurrent-ruby/concurrent}/scheduled_task.rb +30 -17
  75. data/lib/{concurrent → concurrent-ruby/concurrent}/set.rb +17 -19
  76. data/lib/{concurrent → concurrent-ruby/concurrent}/settable_struct.rb +13 -3
  77. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/abstract_lockable_object.rb +5 -1
  78. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/abstract_object.rb +1 -3
  79. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/abstract_struct.rb +11 -0
  80. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/condition.rb +2 -0
  81. data/lib/concurrent-ruby/concurrent/synchronization/full_memory_barrier.rb +29 -0
  82. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/jruby_lockable_object.rb +3 -1
  83. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/lock.rb +2 -0
  84. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/lockable_object.rb +8 -7
  85. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/mutex_lockable_object.rb +18 -5
  86. data/lib/{concurrent → concurrent-ruby/concurrent}/synchronization/object.rb +12 -44
  87. data/lib/concurrent-ruby/concurrent/synchronization/safe_initialization.rb +36 -0
  88. data/lib/concurrent-ruby/concurrent/synchronization/volatile.rb +101 -0
  89. data/lib/concurrent-ruby/concurrent/synchronization.rb +13 -0
  90. data/lib/concurrent-ruby/concurrent/thread_safe/synchronized_delegator.rb +47 -0
  91. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/cheap_lockable.rb +2 -39
  92. data/lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb +52 -0
  93. data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/striped64.rb +1 -1
  94. data/lib/{concurrent → concurrent-ruby/concurrent}/timer_task.rb +11 -34
  95. data/lib/{concurrent → concurrent-ruby/concurrent}/tuple.rb +1 -5
  96. data/lib/{concurrent → concurrent-ruby/concurrent}/tvar.rb +21 -57
  97. data/lib/{concurrent → concurrent-ruby/concurrent}/utility/engine.rb +5 -16
  98. data/lib/concurrent-ruby/concurrent/utility/monotonic_time.rb +19 -0
  99. data/lib/{concurrent → concurrent-ruby/concurrent}/utility/native_extension_loader.rb +8 -10
  100. data/lib/{concurrent → concurrent-ruby/concurrent}/utility/native_integer.rb +1 -0
  101. data/lib/concurrent-ruby/concurrent/utility/processor_counter.rb +110 -0
  102. data/lib/concurrent-ruby/concurrent/version.rb +3 -0
  103. data/lib/concurrent-ruby/concurrent-ruby.rb +5 -0
  104. metadata +127 -129
  105. data/lib/concurrent/atomic/abstract_thread_local_var.rb +0 -66
  106. data/lib/concurrent/atomic/atomic_reference.rb +0 -204
  107. data/lib/concurrent/atomic/java_thread_local_var.rb +0 -37
  108. data/lib/concurrent/atomic/ruby_thread_local_var.rb +0 -161
  109. data/lib/concurrent/atomic/thread_local_var.rb +0 -104
  110. data/lib/concurrent/concern/logging.rb +0 -32
  111. data/lib/concurrent/concurrent_ruby.jar +0 -0
  112. data/lib/concurrent/configuration.rb +0 -184
  113. data/lib/concurrent/synchronization/jruby_object.rb +0 -45
  114. data/lib/concurrent/synchronization/mri_object.rb +0 -44
  115. data/lib/concurrent/synchronization/rbx_lockable_object.rb +0 -65
  116. data/lib/concurrent/synchronization/rbx_object.rb +0 -49
  117. data/lib/concurrent/synchronization/truffleruby_object.rb +0 -47
  118. data/lib/concurrent/synchronization/volatile.rb +0 -36
  119. data/lib/concurrent/synchronization.rb +0 -30
  120. data/lib/concurrent/thread_safe/synchronized_delegator.rb +0 -50
  121. data/lib/concurrent/thread_safe/util/data_structures.rb +0 -63
  122. data/lib/concurrent/utility/at_exit.rb +0 -97
  123. data/lib/concurrent/utility/monotonic_time.rb +0 -58
  124. data/lib/concurrent/utility/processor_counter.rb +0 -158
  125. data/lib/concurrent/version.rb +0 -3
  126. data/lib/concurrent-ruby.rb +0 -1
  127. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic/count_down_latch.rb +1 -1
  128. data/lib/{concurrent → concurrent-ruby/concurrent}/atomic_reference/numeric_cas_wrapper.rb +0 -0
  129. data/lib/{concurrent → concurrent-ruby/concurrent}/atomics.rb +0 -0
  130. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/java_non_concurrent_priority_queue.rb +0 -0
  131. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/atomic_reference_map_backend.rb +0 -0
  132. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/map/synchronized_map_backend.rb +0 -0
  133. data/lib/{concurrent → concurrent-ruby/concurrent}/collection/non_concurrent_priority_queue.rb +1 -1
  134. /data/lib/{concurrent → concurrent-ruby/concurrent}/concern/deprecation.rb +0 -0
  135. /data/lib/{concurrent → concurrent-ruby/concurrent}/concern/obligation.rb +0 -0
  136. /data/lib/{concurrent → concurrent-ruby/concurrent}/concern/observable.rb +0 -0
  137. /data/lib/{concurrent → concurrent-ruby/concurrent}/constants.rb +0 -0
  138. /data/lib/{concurrent → concurrent-ruby/concurrent}/dataflow.rb +0 -0
  139. /data/lib/{concurrent → concurrent-ruby/concurrent}/executor/immediate_executor.rb +0 -0
  140. /data/lib/{concurrent → concurrent-ruby/concurrent}/executor/indirect_immediate_executor.rb +0 -0
  141. /data/lib/{concurrent → concurrent-ruby/concurrent}/executor/serial_executor_service.rb +0 -0
  142. /data/lib/{concurrent → concurrent-ruby/concurrent}/executor/serialized_execution_delegator.rb +0 -0
  143. /data/lib/{concurrent → concurrent-ruby/concurrent}/executors.rb +0 -0
  144. /data/lib/{concurrent → concurrent-ruby/concurrent}/future.rb +0 -0
  145. /data/lib/{concurrent → concurrent-ruby/concurrent}/options.rb +0 -0
  146. /data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/adder.rb +0 -0
  147. /data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/power_of_two_tuple.rb +0 -0
  148. /data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/volatile.rb +0 -0
  149. /data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util/xor_shift_random.rb +0 -0
  150. /data/lib/{concurrent → concurrent-ruby/concurrent}/thread_safe/util.rb +0 -0
  151. /data/lib/{concurrent.rb → concurrent-ruby/concurrent.rb} +0 -0
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.1.5
4
+ version: 1.2.2
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: 2019-03-11 00:00:00.000000000 Z
13
+ date: 2023-02-24 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,12 @@ executables: []
20
20
  extensions: []
21
21
  extra_rdoc_files:
22
22
  - README.md
23
- - LICENSE.md
23
+ - LICENSE.txt
24
24
  - CHANGELOG.md
25
25
  files:
26
26
  - CHANGELOG.md
27
27
  - Gemfile
28
- - LICENSE.md
28
+ - LICENSE.txt
29
29
  - README.md
30
30
  - Rakefile
31
31
  - ext/concurrent-ruby/ConcurrentRubyService.java
@@ -43,149 +43,147 @@ files:
43
43
  - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/LongAdder.java
44
44
  - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/Striped64.java
45
45
  - ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166y/ThreadLocalRandom.java
46
- - lib/concurrent-ruby.rb
47
- - lib/concurrent.rb
48
- - lib/concurrent/agent.rb
49
- - lib/concurrent/array.rb
50
- - lib/concurrent/async.rb
51
- - lib/concurrent/atom.rb
52
- - lib/concurrent/atomic/abstract_thread_local_var.rb
53
- - lib/concurrent/atomic/atomic_boolean.rb
54
- - lib/concurrent/atomic/atomic_fixnum.rb
55
- - lib/concurrent/atomic/atomic_markable_reference.rb
56
- - lib/concurrent/atomic/atomic_reference.rb
57
- - lib/concurrent/atomic/count_down_latch.rb
58
- - lib/concurrent/atomic/cyclic_barrier.rb
59
- - lib/concurrent/atomic/event.rb
60
- - lib/concurrent/atomic/java_count_down_latch.rb
61
- - lib/concurrent/atomic/java_thread_local_var.rb
62
- - lib/concurrent/atomic/mutex_atomic_boolean.rb
63
- - lib/concurrent/atomic/mutex_atomic_fixnum.rb
64
- - lib/concurrent/atomic/mutex_count_down_latch.rb
65
- - lib/concurrent/atomic/mutex_semaphore.rb
66
- - lib/concurrent/atomic/read_write_lock.rb
67
- - lib/concurrent/atomic/reentrant_read_write_lock.rb
68
- - lib/concurrent/atomic/ruby_thread_local_var.rb
69
- - lib/concurrent/atomic/semaphore.rb
70
- - lib/concurrent/atomic/thread_local_var.rb
71
- - lib/concurrent/atomic_reference/mutex_atomic.rb
72
- - lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
73
- - lib/concurrent/atomics.rb
74
- - lib/concurrent/collection/copy_on_notify_observer_set.rb
75
- - lib/concurrent/collection/copy_on_write_observer_set.rb
76
- - lib/concurrent/collection/java_non_concurrent_priority_queue.rb
77
- - lib/concurrent/collection/lock_free_stack.rb
78
- - lib/concurrent/collection/map/atomic_reference_map_backend.rb
79
- - lib/concurrent/collection/map/mri_map_backend.rb
80
- - lib/concurrent/collection/map/non_concurrent_map_backend.rb
81
- - lib/concurrent/collection/map/synchronized_map_backend.rb
82
- - lib/concurrent/collection/non_concurrent_priority_queue.rb
83
- - lib/concurrent/collection/ruby_non_concurrent_priority_queue.rb
84
- - lib/concurrent/concern/deprecation.rb
85
- - lib/concurrent/concern/dereferenceable.rb
86
- - lib/concurrent/concern/logging.rb
87
- - lib/concurrent/concern/obligation.rb
88
- - lib/concurrent/concern/observable.rb
89
- - lib/concurrent/concurrent_ruby.jar
90
- - lib/concurrent/configuration.rb
91
- - lib/concurrent/constants.rb
92
- - lib/concurrent/dataflow.rb
93
- - lib/concurrent/delay.rb
94
- - lib/concurrent/errors.rb
95
- - lib/concurrent/exchanger.rb
96
- - lib/concurrent/executor/abstract_executor_service.rb
97
- - lib/concurrent/executor/cached_thread_pool.rb
98
- - lib/concurrent/executor/executor_service.rb
99
- - lib/concurrent/executor/fixed_thread_pool.rb
100
- - lib/concurrent/executor/immediate_executor.rb
101
- - lib/concurrent/executor/indirect_immediate_executor.rb
102
- - lib/concurrent/executor/java_executor_service.rb
103
- - lib/concurrent/executor/java_single_thread_executor.rb
104
- - lib/concurrent/executor/java_thread_pool_executor.rb
105
- - lib/concurrent/executor/ruby_executor_service.rb
106
- - lib/concurrent/executor/ruby_single_thread_executor.rb
107
- - lib/concurrent/executor/ruby_thread_pool_executor.rb
108
- - lib/concurrent/executor/safe_task_executor.rb
109
- - lib/concurrent/executor/serial_executor_service.rb
110
- - lib/concurrent/executor/serialized_execution.rb
111
- - lib/concurrent/executor/serialized_execution_delegator.rb
112
- - lib/concurrent/executor/simple_executor_service.rb
113
- - lib/concurrent/executor/single_thread_executor.rb
114
- - lib/concurrent/executor/thread_pool_executor.rb
115
- - lib/concurrent/executor/timer_set.rb
116
- - lib/concurrent/executors.rb
117
- - lib/concurrent/future.rb
118
- - lib/concurrent/hash.rb
119
- - lib/concurrent/immutable_struct.rb
120
- - lib/concurrent/ivar.rb
121
- - lib/concurrent/map.rb
122
- - lib/concurrent/maybe.rb
123
- - lib/concurrent/mutable_struct.rb
124
- - lib/concurrent/mvar.rb
125
- - lib/concurrent/options.rb
126
- - lib/concurrent/promise.rb
127
- - lib/concurrent/promises.rb
128
- - lib/concurrent/re_include.rb
129
- - lib/concurrent/scheduled_task.rb
130
- - lib/concurrent/set.rb
131
- - lib/concurrent/settable_struct.rb
132
- - lib/concurrent/synchronization.rb
133
- - lib/concurrent/synchronization/abstract_lockable_object.rb
134
- - lib/concurrent/synchronization/abstract_object.rb
135
- - lib/concurrent/synchronization/abstract_struct.rb
136
- - lib/concurrent/synchronization/condition.rb
137
- - lib/concurrent/synchronization/jruby_lockable_object.rb
138
- - lib/concurrent/synchronization/jruby_object.rb
139
- - lib/concurrent/synchronization/lock.rb
140
- - lib/concurrent/synchronization/lockable_object.rb
141
- - lib/concurrent/synchronization/mri_object.rb
142
- - lib/concurrent/synchronization/mutex_lockable_object.rb
143
- - lib/concurrent/synchronization/object.rb
144
- - lib/concurrent/synchronization/rbx_lockable_object.rb
145
- - lib/concurrent/synchronization/rbx_object.rb
146
- - lib/concurrent/synchronization/truffleruby_object.rb
147
- - lib/concurrent/synchronization/volatile.rb
148
- - lib/concurrent/thread_safe/synchronized_delegator.rb
149
- - lib/concurrent/thread_safe/util.rb
150
- - lib/concurrent/thread_safe/util/adder.rb
151
- - lib/concurrent/thread_safe/util/cheap_lockable.rb
152
- - lib/concurrent/thread_safe/util/data_structures.rb
153
- - lib/concurrent/thread_safe/util/power_of_two_tuple.rb
154
- - lib/concurrent/thread_safe/util/striped64.rb
155
- - lib/concurrent/thread_safe/util/volatile.rb
156
- - lib/concurrent/thread_safe/util/xor_shift_random.rb
157
- - lib/concurrent/timer_task.rb
158
- - lib/concurrent/tuple.rb
159
- - lib/concurrent/tvar.rb
160
- - lib/concurrent/utility/at_exit.rb
161
- - lib/concurrent/utility/engine.rb
162
- - lib/concurrent/utility/monotonic_time.rb
163
- - lib/concurrent/utility/native_extension_loader.rb
164
- - lib/concurrent/utility/native_integer.rb
165
- - lib/concurrent/utility/processor_counter.rb
166
- - lib/concurrent/version.rb
46
+ - lib/concurrent-ruby/concurrent-ruby.rb
47
+ - lib/concurrent-ruby/concurrent.rb
48
+ - lib/concurrent-ruby/concurrent/agent.rb
49
+ - lib/concurrent-ruby/concurrent/array.rb
50
+ - lib/concurrent-ruby/concurrent/async.rb
51
+ - lib/concurrent-ruby/concurrent/atom.rb
52
+ - lib/concurrent-ruby/concurrent/atomic/atomic_boolean.rb
53
+ - lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb
54
+ - lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb
55
+ - lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb
56
+ - lib/concurrent-ruby/concurrent/atomic/count_down_latch.rb
57
+ - lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb
58
+ - lib/concurrent-ruby/concurrent/atomic/event.rb
59
+ - lib/concurrent-ruby/concurrent/atomic/fiber_local_var.rb
60
+ - lib/concurrent-ruby/concurrent/atomic/java_count_down_latch.rb
61
+ - lib/concurrent-ruby/concurrent/atomic/locals.rb
62
+ - lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb
63
+ - lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb
64
+ - lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb
65
+ - lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb
66
+ - lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb
67
+ - lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb
68
+ - lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb
69
+ - lib/concurrent-ruby/concurrent/atomic/semaphore.rb
70
+ - lib/concurrent-ruby/concurrent/atomic/thread_local_var.rb
71
+ - lib/concurrent-ruby/concurrent/atomic_reference/atomic_direct_update.rb
72
+ - lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb
73
+ - lib/concurrent-ruby/concurrent/atomic_reference/numeric_cas_wrapper.rb
74
+ - lib/concurrent-ruby/concurrent/atomics.rb
75
+ - lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb
76
+ - lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb
77
+ - lib/concurrent-ruby/concurrent/collection/java_non_concurrent_priority_queue.rb
78
+ - lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb
79
+ - lib/concurrent-ruby/concurrent/collection/map/atomic_reference_map_backend.rb
80
+ - lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb
81
+ - lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb
82
+ - lib/concurrent-ruby/concurrent/collection/map/synchronized_map_backend.rb
83
+ - lib/concurrent-ruby/concurrent/collection/map/truffleruby_map_backend.rb
84
+ - lib/concurrent-ruby/concurrent/collection/non_concurrent_priority_queue.rb
85
+ - lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb
86
+ - lib/concurrent-ruby/concurrent/concern/deprecation.rb
87
+ - lib/concurrent-ruby/concurrent/concern/dereferenceable.rb
88
+ - lib/concurrent-ruby/concurrent/concern/logging.rb
89
+ - lib/concurrent-ruby/concurrent/concern/obligation.rb
90
+ - lib/concurrent-ruby/concurrent/concern/observable.rb
91
+ - lib/concurrent-ruby/concurrent/concurrent_ruby.jar
92
+ - lib/concurrent-ruby/concurrent/configuration.rb
93
+ - lib/concurrent-ruby/concurrent/constants.rb
94
+ - lib/concurrent-ruby/concurrent/dataflow.rb
95
+ - lib/concurrent-ruby/concurrent/delay.rb
96
+ - lib/concurrent-ruby/concurrent/errors.rb
97
+ - lib/concurrent-ruby/concurrent/exchanger.rb
98
+ - lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb
99
+ - lib/concurrent-ruby/concurrent/executor/cached_thread_pool.rb
100
+ - lib/concurrent-ruby/concurrent/executor/executor_service.rb
101
+ - lib/concurrent-ruby/concurrent/executor/fixed_thread_pool.rb
102
+ - lib/concurrent-ruby/concurrent/executor/immediate_executor.rb
103
+ - lib/concurrent-ruby/concurrent/executor/indirect_immediate_executor.rb
104
+ - lib/concurrent-ruby/concurrent/executor/java_executor_service.rb
105
+ - lib/concurrent-ruby/concurrent/executor/java_single_thread_executor.rb
106
+ - lib/concurrent-ruby/concurrent/executor/java_thread_pool_executor.rb
107
+ - lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb
108
+ - lib/concurrent-ruby/concurrent/executor/ruby_single_thread_executor.rb
109
+ - lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb
110
+ - lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb
111
+ - lib/concurrent-ruby/concurrent/executor/serial_executor_service.rb
112
+ - lib/concurrent-ruby/concurrent/executor/serialized_execution.rb
113
+ - lib/concurrent-ruby/concurrent/executor/serialized_execution_delegator.rb
114
+ - lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb
115
+ - lib/concurrent-ruby/concurrent/executor/single_thread_executor.rb
116
+ - lib/concurrent-ruby/concurrent/executor/thread_pool_executor.rb
117
+ - lib/concurrent-ruby/concurrent/executor/timer_set.rb
118
+ - lib/concurrent-ruby/concurrent/executors.rb
119
+ - lib/concurrent-ruby/concurrent/future.rb
120
+ - lib/concurrent-ruby/concurrent/hash.rb
121
+ - lib/concurrent-ruby/concurrent/immutable_struct.rb
122
+ - lib/concurrent-ruby/concurrent/ivar.rb
123
+ - lib/concurrent-ruby/concurrent/map.rb
124
+ - lib/concurrent-ruby/concurrent/maybe.rb
125
+ - lib/concurrent-ruby/concurrent/mutable_struct.rb
126
+ - lib/concurrent-ruby/concurrent/mvar.rb
127
+ - lib/concurrent-ruby/concurrent/options.rb
128
+ - lib/concurrent-ruby/concurrent/promise.rb
129
+ - lib/concurrent-ruby/concurrent/promises.rb
130
+ - lib/concurrent-ruby/concurrent/re_include.rb
131
+ - lib/concurrent-ruby/concurrent/scheduled_task.rb
132
+ - lib/concurrent-ruby/concurrent/set.rb
133
+ - lib/concurrent-ruby/concurrent/settable_struct.rb
134
+ - lib/concurrent-ruby/concurrent/synchronization.rb
135
+ - lib/concurrent-ruby/concurrent/synchronization/abstract_lockable_object.rb
136
+ - lib/concurrent-ruby/concurrent/synchronization/abstract_object.rb
137
+ - lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb
138
+ - lib/concurrent-ruby/concurrent/synchronization/condition.rb
139
+ - lib/concurrent-ruby/concurrent/synchronization/full_memory_barrier.rb
140
+ - lib/concurrent-ruby/concurrent/synchronization/jruby_lockable_object.rb
141
+ - lib/concurrent-ruby/concurrent/synchronization/lock.rb
142
+ - lib/concurrent-ruby/concurrent/synchronization/lockable_object.rb
143
+ - lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb
144
+ - lib/concurrent-ruby/concurrent/synchronization/object.rb
145
+ - lib/concurrent-ruby/concurrent/synchronization/safe_initialization.rb
146
+ - lib/concurrent-ruby/concurrent/synchronization/volatile.rb
147
+ - lib/concurrent-ruby/concurrent/thread_safe/synchronized_delegator.rb
148
+ - lib/concurrent-ruby/concurrent/thread_safe/util.rb
149
+ - lib/concurrent-ruby/concurrent/thread_safe/util/adder.rb
150
+ - lib/concurrent-ruby/concurrent/thread_safe/util/cheap_lockable.rb
151
+ - lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb
152
+ - lib/concurrent-ruby/concurrent/thread_safe/util/power_of_two_tuple.rb
153
+ - lib/concurrent-ruby/concurrent/thread_safe/util/striped64.rb
154
+ - lib/concurrent-ruby/concurrent/thread_safe/util/volatile.rb
155
+ - lib/concurrent-ruby/concurrent/thread_safe/util/xor_shift_random.rb
156
+ - lib/concurrent-ruby/concurrent/timer_task.rb
157
+ - lib/concurrent-ruby/concurrent/tuple.rb
158
+ - lib/concurrent-ruby/concurrent/tvar.rb
159
+ - lib/concurrent-ruby/concurrent/utility/engine.rb
160
+ - lib/concurrent-ruby/concurrent/utility/monotonic_time.rb
161
+ - lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb
162
+ - lib/concurrent-ruby/concurrent/utility/native_integer.rb
163
+ - lib/concurrent-ruby/concurrent/utility/processor_counter.rb
164
+ - lib/concurrent-ruby/concurrent/version.rb
167
165
  homepage: http://www.concurrent-ruby.com
168
166
  licenses:
169
167
  - MIT
170
168
  metadata:
171
169
  source_code_uri: https://github.com/ruby-concurrency/concurrent-ruby
170
+ changelog_uri: https://github.com/ruby-concurrency/concurrent-ruby/blob/master/CHANGELOG.md
172
171
  post_install_message:
173
172
  rdoc_options: []
174
173
  require_paths:
175
- - lib
174
+ - lib/concurrent-ruby
176
175
  required_ruby_version: !ruby/object:Gem::Requirement
177
176
  requirements:
178
177
  - - ">="
179
178
  - !ruby/object:Gem::Version
180
- version: 1.9.3
179
+ version: '2.3'
181
180
  required_rubygems_version: !ruby/object:Gem::Requirement
182
181
  requirements:
183
182
  - - ">="
184
183
  - !ruby/object:Gem::Version
185
184
  version: '0'
186
185
  requirements: []
187
- rubyforge_project:
188
- rubygems_version: 2.7.8
186
+ rubygems_version: 3.3.26
189
187
  signing_key:
190
188
  specification_version: 4
191
189
  summary: Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell,
@@ -1,66 +0,0 @@
1
- require 'concurrent/constants'
2
-
3
- module Concurrent
4
-
5
- # @!macro thread_local_var
6
- # @!macro internal_implementation_note
7
- # @!visibility private
8
- class AbstractThreadLocalVar
9
-
10
- # @!macro thread_local_var_method_initialize
11
- def initialize(default = nil, &default_block)
12
- if default && block_given?
13
- raise ArgumentError, "Cannot use both value and block as default value"
14
- end
15
-
16
- if block_given?
17
- @default_block = default_block
18
- @default = nil
19
- else
20
- @default_block = nil
21
- @default = default
22
- end
23
-
24
- allocate_storage
25
- end
26
-
27
- # @!macro thread_local_var_method_get
28
- def value
29
- raise NotImplementedError
30
- end
31
-
32
- # @!macro thread_local_var_method_set
33
- def value=(value)
34
- raise NotImplementedError
35
- end
36
-
37
- # @!macro thread_local_var_method_bind
38
- def bind(value, &block)
39
- if block_given?
40
- old_value = self.value
41
- begin
42
- self.value = value
43
- yield
44
- ensure
45
- self.value = old_value
46
- end
47
- end
48
- end
49
-
50
- protected
51
-
52
- # @!visibility private
53
- def allocate_storage
54
- raise NotImplementedError
55
- end
56
-
57
- # @!visibility private
58
- def default
59
- if @default_block
60
- self.value = @default_block.call
61
- else
62
- @default
63
- end
64
- end
65
- end
66
- end
@@ -1,204 +0,0 @@
1
- require 'concurrent/synchronization'
2
- require 'concurrent/utility/engine'
3
- require 'concurrent/atomic_reference/numeric_cas_wrapper'
4
-
5
- # Shim for TruffleRuby::AtomicReference
6
- if Concurrent.on_truffleruby? && !defined?(TruffleRuby::AtomicReference)
7
- # @!visibility private
8
- module TruffleRuby
9
- AtomicReference = Truffle::AtomicReference
10
- end
11
- end
12
-
13
- module Concurrent
14
-
15
- # Define update methods that use direct paths
16
- #
17
- # @!visibility private
18
- # @!macro internal_implementation_note
19
- module AtomicDirectUpdate
20
-
21
- # @!macro atomic_reference_method_update
22
- #
23
- # Pass the current value to the given block, replacing it
24
- # with the block's result. May retry if the value changes
25
- # during the block's execution.
26
- #
27
- # @yield [Object] Calculate a new value for the atomic reference using
28
- # given (old) value
29
- # @yieldparam [Object] old_value the starting value of the atomic reference
30
- # @return [Object] the new value
31
- def update
32
- true until compare_and_set(old_value = get, new_value = yield(old_value))
33
- new_value
34
- end
35
-
36
- # @!macro atomic_reference_method_try_update
37
- #
38
- # Pass the current value to the given block, replacing it
39
- # with the block's result. Return nil if the update fails.
40
- #
41
- # @yield [Object] Calculate a new value for the atomic reference using
42
- # given (old) value
43
- # @yieldparam [Object] old_value the starting value of the atomic reference
44
- # @note This method was altered to avoid raising an exception by default.
45
- # Instead, this method now returns `nil` in case of failure. For more info,
46
- # please see: https://github.com/ruby-concurrency/concurrent-ruby/pull/336
47
- # @return [Object] the new value, or nil if update failed
48
- def try_update
49
- old_value = get
50
- new_value = yield old_value
51
-
52
- return unless compare_and_set old_value, new_value
53
-
54
- new_value
55
- end
56
-
57
- # @!macro atomic_reference_method_try_update!
58
- #
59
- # Pass the current value to the given block, replacing it
60
- # with the block's result. Raise an exception if the update
61
- # fails.
62
- #
63
- # @yield [Object] Calculate a new value for the atomic reference using
64
- # given (old) value
65
- # @yieldparam [Object] old_value the starting value of the atomic reference
66
- # @note This behavior mimics the behavior of the original
67
- # `AtomicReference#try_update` API. The reason this was changed was to
68
- # avoid raising exceptions (which are inherently slow) by default. For more
69
- # info: https://github.com/ruby-concurrency/concurrent-ruby/pull/336
70
- # @return [Object] the new value
71
- # @raise [Concurrent::ConcurrentUpdateError] if the update fails
72
- def try_update!
73
- old_value = get
74
- new_value = yield old_value
75
- unless compare_and_set(old_value, new_value)
76
- if $VERBOSE
77
- raise ConcurrentUpdateError, "Update failed"
78
- else
79
- raise ConcurrentUpdateError, "Update failed", ConcurrentUpdateError::CONC_UP_ERR_BACKTRACE
80
- end
81
- end
82
- new_value
83
- end
84
- end
85
-
86
- require 'concurrent/atomic_reference/mutex_atomic'
87
-
88
- # @!macro atomic_reference
89
- #
90
- # An object reference that may be updated atomically. All read and write
91
- # operations have java volatile semantic.
92
- #
93
- # @!macro thread_safe_variable_comparison
94
- #
95
- # @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicReference.html
96
- # @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/package-summary.html
97
- #
98
- # @!method initialize(value = nil)
99
- # @!macro atomic_reference_method_initialize
100
- # @param [Object] value The initial value.
101
- #
102
- # @!method get
103
- # @!macro atomic_reference_method_get
104
- # Gets the current value.
105
- # @return [Object] the current value
106
- #
107
- # @!method set(new_value)
108
- # @!macro atomic_reference_method_set
109
- # Sets to the given value.
110
- # @param [Object] new_value the new value
111
- # @return [Object] the new value
112
- #
113
- # @!method get_and_set(new_value)
114
- # @!macro atomic_reference_method_get_and_set
115
- # Atomically sets to the given value and returns the old value.
116
- # @param [Object] new_value the new value
117
- # @return [Object] the old value
118
- #
119
- # @!method compare_and_set(old_value, new_value)
120
- # @!macro atomic_reference_method_compare_and_set
121
- #
122
- # Atomically sets the value to the given updated value if
123
- # the current value == the expected value.
124
- #
125
- # @param [Object] old_value the expected value
126
- # @param [Object] new_value the new value
127
- #
128
- # @return [Boolean] `true` if successful. A `false` return indicates
129
- # that the actual value was not equal to the expected value.
130
- #
131
- # @!method update
132
- # @!macro atomic_reference_method_update
133
- #
134
- # @!method try_update
135
- # @!macro atomic_reference_method_try_update
136
- #
137
- # @!method try_update!
138
- # @!macro atomic_reference_method_try_update!
139
-
140
-
141
- # @!macro internal_implementation_note
142
- class ConcurrentUpdateError < ThreadError
143
- # frozen pre-allocated backtrace to speed ConcurrentUpdateError
144
- CONC_UP_ERR_BACKTRACE = ['backtrace elided; set verbose to enable'].freeze
145
- end
146
-
147
- # @!macro internal_implementation_note
148
- AtomicReferenceImplementation = case
149
- when Concurrent.on_cruby? && Concurrent.c_extensions_loaded?
150
- # @!visibility private
151
- # @!macro internal_implementation_note
152
- class CAtomicReference
153
- include AtomicDirectUpdate
154
- include AtomicNumericCompareAndSetWrapper
155
- alias_method :compare_and_swap, :compare_and_set
156
- end
157
- CAtomicReference
158
- when Concurrent.on_jruby?
159
- # @!visibility private
160
- # @!macro internal_implementation_note
161
- class JavaAtomicReference
162
- include AtomicDirectUpdate
163
- end
164
- JavaAtomicReference
165
- when Concurrent.on_truffleruby?
166
- class TruffleRubyAtomicReference < TruffleRuby::AtomicReference
167
- include AtomicDirectUpdate
168
- alias_method :value, :get
169
- alias_method :value=, :set
170
- alias_method :compare_and_swap, :compare_and_set
171
- alias_method :swap, :get_and_set
172
- end
173
- when Concurrent.on_rbx?
174
- # @note Extends `Rubinius::AtomicReference` version adding aliases
175
- # and numeric logic.
176
- #
177
- # @!visibility private
178
- # @!macro internal_implementation_note
179
- class RbxAtomicReference < Rubinius::AtomicReference
180
- alias_method :_compare_and_set, :compare_and_set
181
- include AtomicDirectUpdate
182
- include AtomicNumericCompareAndSetWrapper
183
- alias_method :value, :get
184
- alias_method :value=, :set
185
- alias_method :swap, :get_and_set
186
- alias_method :compare_and_swap, :compare_and_set
187
- end
188
- RbxAtomicReference
189
- else
190
- MutexAtomicReference
191
- end
192
- private_constant :AtomicReferenceImplementation
193
-
194
- # @!macro atomic_reference
195
- class AtomicReference < AtomicReferenceImplementation
196
-
197
- # @return [String] Short string representation.
198
- def to_s
199
- format '%s value:%s>', super[0..-2], get
200
- end
201
-
202
- alias_method :inspect, :to_s
203
- end
204
- end
@@ -1,37 +0,0 @@
1
- require 'concurrent/atomic/abstract_thread_local_var'
2
-
3
- if Concurrent.on_jruby?
4
-
5
- module Concurrent
6
-
7
- # @!visibility private
8
- # @!macro internal_implementation_note
9
- class JavaThreadLocalVar < AbstractThreadLocalVar
10
-
11
- # @!macro thread_local_var_method_get
12
- def value
13
- value = @var.get
14
-
15
- if value.nil?
16
- default
17
- elsif value == NULL
18
- nil
19
- else
20
- value
21
- end
22
- end
23
-
24
- # @!macro thread_local_var_method_set
25
- def value=(value)
26
- @var.set(value)
27
- end
28
-
29
- protected
30
-
31
- # @!visibility private
32
- def allocate_storage
33
- @var = java.lang.ThreadLocal.new
34
- end
35
- end
36
- end
37
- end