concurrent-ruby 0.6.0.pre.1 → 0.6.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -0
  3. data/lib/concurrent.rb +9 -29
  4. data/lib/concurrent/{actor.rb → actor/actor.rb} +3 -3
  5. data/lib/concurrent/actor/actor_context.rb +77 -0
  6. data/lib/concurrent/actor/actor_ref.rb +67 -0
  7. data/lib/concurrent/{postable.rb → actor/postable.rb} +1 -1
  8. data/lib/concurrent/actor/simple_actor_ref.rb +94 -0
  9. data/lib/concurrent/actors.rb +5 -0
  10. data/lib/concurrent/agent.rb +81 -47
  11. data/lib/concurrent/async.rb +35 -35
  12. data/lib/concurrent/atomic/atomic_boolean.rb +157 -0
  13. data/lib/concurrent/atomic/atomic_fixnum.rb +170 -0
  14. data/lib/concurrent/{condition.rb → atomic/condition.rb} +0 -0
  15. data/lib/concurrent/{copy_on_notify_observer_set.rb → atomic/copy_on_notify_observer_set.rb} +48 -13
  16. data/lib/concurrent/{copy_on_write_observer_set.rb → atomic/copy_on_write_observer_set.rb} +41 -20
  17. data/lib/concurrent/atomic/count_down_latch.rb +116 -0
  18. data/lib/concurrent/atomic/cyclic_barrier.rb +106 -0
  19. data/lib/concurrent/atomic/event.rb +103 -0
  20. data/lib/concurrent/{thread_local_var.rb → atomic/thread_local_var.rb} +0 -0
  21. data/lib/concurrent/atomics.rb +9 -0
  22. data/lib/concurrent/channel/buffered_channel.rb +6 -4
  23. data/lib/concurrent/channel/channel.rb +30 -2
  24. data/lib/concurrent/channel/unbuffered_channel.rb +2 -2
  25. data/lib/concurrent/channel/waitable_list.rb +3 -1
  26. data/lib/concurrent/channels.rb +5 -0
  27. data/lib/concurrent/{channel → collection}/blocking_ring_buffer.rb +16 -5
  28. data/lib/concurrent/collection/priority_queue.rb +305 -0
  29. data/lib/concurrent/{channel → collection}/ring_buffer.rb +6 -1
  30. data/lib/concurrent/collections.rb +3 -0
  31. data/lib/concurrent/configuration.rb +68 -19
  32. data/lib/concurrent/dataflow.rb +9 -9
  33. data/lib/concurrent/delay.rb +21 -13
  34. data/lib/concurrent/dereferenceable.rb +40 -33
  35. data/lib/concurrent/exchanger.rb +3 -0
  36. data/lib/concurrent/{cached_thread_pool.rb → executor/cached_thread_pool.rb} +8 -9
  37. data/lib/concurrent/executor/executor.rb +222 -0
  38. data/lib/concurrent/{fixed_thread_pool.rb → executor/fixed_thread_pool.rb} +6 -7
  39. data/lib/concurrent/{immediate_executor.rb → executor/immediate_executor.rb} +5 -5
  40. data/lib/concurrent/executor/java_cached_thread_pool.rb +31 -0
  41. data/lib/concurrent/{java_fixed_thread_pool.rb → executor/java_fixed_thread_pool.rb} +7 -11
  42. data/lib/concurrent/executor/java_single_thread_executor.rb +21 -0
  43. data/lib/concurrent/{java_thread_pool_executor.rb → executor/java_thread_pool_executor.rb} +66 -77
  44. data/lib/concurrent/executor/one_by_one.rb +65 -0
  45. data/lib/concurrent/{per_thread_executor.rb → executor/per_thread_executor.rb} +4 -4
  46. data/lib/concurrent/executor/ruby_cached_thread_pool.rb +29 -0
  47. data/lib/concurrent/{ruby_fixed_thread_pool.rb → executor/ruby_fixed_thread_pool.rb} +5 -4
  48. data/lib/concurrent/executor/ruby_single_thread_executor.rb +72 -0
  49. data/lib/concurrent/executor/ruby_thread_pool_executor.rb +282 -0
  50. data/lib/concurrent/{ruby_thread_pool_worker.rb → executor/ruby_thread_pool_worker.rb} +6 -6
  51. data/lib/concurrent/{safe_task_executor.rb → executor/safe_task_executor.rb} +20 -13
  52. data/lib/concurrent/executor/single_thread_executor.rb +35 -0
  53. data/lib/concurrent/executor/thread_pool_executor.rb +68 -0
  54. data/lib/concurrent/executor/timer_set.rb +138 -0
  55. data/lib/concurrent/executors.rb +9 -0
  56. data/lib/concurrent/future.rb +39 -40
  57. data/lib/concurrent/ivar.rb +22 -15
  58. data/lib/concurrent/mvar.rb +2 -1
  59. data/lib/concurrent/obligation.rb +9 -3
  60. data/lib/concurrent/observable.rb +33 -0
  61. data/lib/concurrent/options_parser.rb +46 -0
  62. data/lib/concurrent/promise.rb +23 -24
  63. data/lib/concurrent/scheduled_task.rb +21 -45
  64. data/lib/concurrent/timer_task.rb +204 -126
  65. data/lib/concurrent/tvar.rb +1 -1
  66. data/lib/concurrent/utilities.rb +3 -36
  67. data/lib/concurrent/{processor_count.rb → utility/processor_count.rb} +1 -1
  68. data/lib/concurrent/utility/timeout.rb +36 -0
  69. data/lib/concurrent/utility/timer.rb +21 -0
  70. data/lib/concurrent/version.rb +1 -1
  71. data/lib/concurrent_ruby_ext.bundle +0 -0
  72. data/spec/concurrent/{actor_context_spec.rb → actor/actor_context_spec.rb} +0 -8
  73. data/spec/concurrent/{actor_ref_shared.rb → actor/actor_ref_shared.rb} +9 -59
  74. data/spec/concurrent/{actor_spec.rb → actor/actor_spec.rb} +43 -41
  75. data/spec/concurrent/{postable_shared.rb → actor/postable_shared.rb} +0 -0
  76. data/spec/concurrent/actor/simple_actor_ref_spec.rb +135 -0
  77. data/spec/concurrent/agent_spec.rb +160 -71
  78. data/spec/concurrent/atomic/atomic_boolean_spec.rb +172 -0
  79. data/spec/concurrent/atomic/atomic_fixnum_spec.rb +186 -0
  80. data/spec/concurrent/{condition_spec.rb → atomic/condition_spec.rb} +2 -2
  81. data/spec/concurrent/{copy_on_notify_observer_set_spec.rb → atomic/copy_on_notify_observer_set_spec.rb} +0 -0
  82. data/spec/concurrent/{copy_on_write_observer_set_spec.rb → atomic/copy_on_write_observer_set_spec.rb} +0 -0
  83. data/spec/concurrent/atomic/count_down_latch_spec.rb +151 -0
  84. data/spec/concurrent/atomic/cyclic_barrier_spec.rb +248 -0
  85. data/spec/concurrent/{event_spec.rb → atomic/event_spec.rb} +18 -3
  86. data/spec/concurrent/{observer_set_shared.rb → atomic/observer_set_shared.rb} +15 -6
  87. data/spec/concurrent/{thread_local_var_spec.rb → atomic/thread_local_var_spec.rb} +0 -0
  88. data/spec/concurrent/channel/buffered_channel_spec.rb +1 -1
  89. data/spec/concurrent/channel/channel_spec.rb +6 -4
  90. data/spec/concurrent/channel/probe_spec.rb +37 -9
  91. data/spec/concurrent/channel/unbuffered_channel_spec.rb +2 -2
  92. data/spec/concurrent/{channel → collection}/blocking_ring_buffer_spec.rb +0 -0
  93. data/spec/concurrent/collection/priority_queue_spec.rb +317 -0
  94. data/spec/concurrent/{channel → collection}/ring_buffer_spec.rb +0 -0
  95. data/spec/concurrent/configuration_spec.rb +4 -70
  96. data/spec/concurrent/dereferenceable_shared.rb +5 -4
  97. data/spec/concurrent/exchanger_spec.rb +10 -5
  98. data/spec/concurrent/{cached_thread_pool_shared.rb → executor/cached_thread_pool_shared.rb} +15 -37
  99. data/spec/concurrent/{fixed_thread_pool_shared.rb → executor/fixed_thread_pool_shared.rb} +0 -0
  100. data/spec/concurrent/{global_thread_pool_shared.rb → executor/global_thread_pool_shared.rb} +10 -8
  101. data/spec/concurrent/{immediate_executor_spec.rb → executor/immediate_executor_spec.rb} +0 -0
  102. data/spec/concurrent/{java_cached_thread_pool_spec.rb → executor/java_cached_thread_pool_spec.rb} +1 -21
  103. data/spec/concurrent/{java_fixed_thread_pool_spec.rb → executor/java_fixed_thread_pool_spec.rb} +0 -0
  104. data/spec/concurrent/executor/java_single_thread_executor_spec.rb +21 -0
  105. data/spec/concurrent/{java_thread_pool_executor_spec.rb → executor/java_thread_pool_executor_spec.rb} +0 -0
  106. data/spec/concurrent/{per_thread_executor_spec.rb → executor/per_thread_executor_spec.rb} +0 -4
  107. data/spec/concurrent/{ruby_cached_thread_pool_spec.rb → executor/ruby_cached_thread_pool_spec.rb} +1 -1
  108. data/spec/concurrent/{ruby_fixed_thread_pool_spec.rb → executor/ruby_fixed_thread_pool_spec.rb} +0 -0
  109. data/spec/concurrent/executor/ruby_single_thread_executor_spec.rb +18 -0
  110. data/spec/concurrent/{ruby_thread_pool_executor_spec.rb → executor/ruby_thread_pool_executor_spec.rb} +12 -24
  111. data/spec/concurrent/executor/safe_task_executor_spec.rb +103 -0
  112. data/spec/concurrent/{thread_pool_class_cast_spec.rb → executor/thread_pool_class_cast_spec.rb} +12 -0
  113. data/spec/concurrent/{thread_pool_executor_shared.rb → executor/thread_pool_executor_shared.rb} +0 -0
  114. data/spec/concurrent/{thread_pool_shared.rb → executor/thread_pool_shared.rb} +84 -119
  115. data/spec/concurrent/executor/timer_set_spec.rb +183 -0
  116. data/spec/concurrent/future_spec.rb +12 -0
  117. data/spec/concurrent/ivar_spec.rb +11 -1
  118. data/spec/concurrent/observable_shared.rb +173 -0
  119. data/spec/concurrent/observable_spec.rb +51 -0
  120. data/spec/concurrent/options_parser_spec.rb +71 -0
  121. data/spec/concurrent/runnable_shared.rb +6 -0
  122. data/spec/concurrent/scheduled_task_spec.rb +60 -40
  123. data/spec/concurrent/timer_task_spec.rb +130 -144
  124. data/spec/concurrent/{processor_count_spec.rb → utility/processor_count_spec.rb} +0 -0
  125. data/spec/concurrent/{utilities_spec.rb → utility/timeout_spec.rb} +0 -0
  126. data/spec/concurrent/utility/timer_spec.rb +52 -0
  127. metadata +147 -108
  128. data/lib/concurrent/actor_context.rb +0 -31
  129. data/lib/concurrent/actor_ref.rb +0 -39
  130. data/lib/concurrent/atomic.rb +0 -121
  131. data/lib/concurrent/channel/probe.rb +0 -19
  132. data/lib/concurrent/count_down_latch.rb +0 -60
  133. data/lib/concurrent/event.rb +0 -80
  134. data/lib/concurrent/java_cached_thread_pool.rb +0 -45
  135. data/lib/concurrent/ruby_cached_thread_pool.rb +0 -37
  136. data/lib/concurrent/ruby_thread_pool_executor.rb +0 -268
  137. data/lib/concurrent/simple_actor_ref.rb +0 -124
  138. data/lib/concurrent/thread_pool_executor.rb +0 -30
  139. data/spec/concurrent/atomic_spec.rb +0 -201
  140. data/spec/concurrent/count_down_latch_spec.rb +0 -125
  141. data/spec/concurrent/safe_task_executor_spec.rb +0 -58
  142. data/spec/concurrent/simple_actor_ref_spec.rb +0 -219
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concurrent-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.pre.1
4
+ version: 0.6.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry D'Antonio
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2014-05-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.
@@ -23,116 +23,144 @@ files:
23
23
  - LICENSE
24
24
  - README.md
25
25
  - lib/concurrent.rb
26
- - lib/concurrent/actor.rb
27
- - lib/concurrent/actor_context.rb
28
- - lib/concurrent/actor_ref.rb
26
+ - lib/concurrent/actor/actor.rb
27
+ - lib/concurrent/actor/actor_context.rb
28
+ - lib/concurrent/actor/actor_ref.rb
29
+ - lib/concurrent/actor/postable.rb
30
+ - lib/concurrent/actor/simple_actor_ref.rb
31
+ - lib/concurrent/actors.rb
29
32
  - lib/concurrent/agent.rb
30
33
  - lib/concurrent/async.rb
31
- - lib/concurrent/atomic.rb
32
- - lib/concurrent/cached_thread_pool.rb
33
- - lib/concurrent/channel/blocking_ring_buffer.rb
34
+ - lib/concurrent/atomic/atomic_boolean.rb
35
+ - lib/concurrent/atomic/atomic_fixnum.rb
36
+ - lib/concurrent/atomic/condition.rb
37
+ - lib/concurrent/atomic/copy_on_notify_observer_set.rb
38
+ - lib/concurrent/atomic/copy_on_write_observer_set.rb
39
+ - lib/concurrent/atomic/count_down_latch.rb
40
+ - lib/concurrent/atomic/cyclic_barrier.rb
41
+ - lib/concurrent/atomic/event.rb
42
+ - lib/concurrent/atomic/thread_local_var.rb
43
+ - lib/concurrent/atomics.rb
34
44
  - lib/concurrent/channel/buffered_channel.rb
35
45
  - lib/concurrent/channel/channel.rb
36
- - lib/concurrent/channel/probe.rb
37
- - lib/concurrent/channel/ring_buffer.rb
38
46
  - lib/concurrent/channel/unbuffered_channel.rb
39
47
  - lib/concurrent/channel/waitable_list.rb
40
- - lib/concurrent/condition.rb
48
+ - lib/concurrent/channels.rb
49
+ - lib/concurrent/collection/blocking_ring_buffer.rb
50
+ - lib/concurrent/collection/priority_queue.rb
51
+ - lib/concurrent/collection/ring_buffer.rb
52
+ - lib/concurrent/collections.rb
41
53
  - lib/concurrent/configuration.rb
42
- - lib/concurrent/copy_on_notify_observer_set.rb
43
- - lib/concurrent/copy_on_write_observer_set.rb
44
- - lib/concurrent/count_down_latch.rb
45
54
  - lib/concurrent/dataflow.rb
46
55
  - lib/concurrent/delay.rb
47
56
  - lib/concurrent/dereferenceable.rb
48
- - lib/concurrent/event.rb
49
57
  - lib/concurrent/exchanger.rb
50
- - lib/concurrent/fixed_thread_pool.rb
58
+ - lib/concurrent/executor/cached_thread_pool.rb
59
+ - lib/concurrent/executor/executor.rb
60
+ - lib/concurrent/executor/fixed_thread_pool.rb
61
+ - lib/concurrent/executor/immediate_executor.rb
62
+ - lib/concurrent/executor/java_cached_thread_pool.rb
63
+ - lib/concurrent/executor/java_fixed_thread_pool.rb
64
+ - lib/concurrent/executor/java_single_thread_executor.rb
65
+ - lib/concurrent/executor/java_thread_pool_executor.rb
66
+ - lib/concurrent/executor/one_by_one.rb
67
+ - lib/concurrent/executor/per_thread_executor.rb
68
+ - lib/concurrent/executor/ruby_cached_thread_pool.rb
69
+ - lib/concurrent/executor/ruby_fixed_thread_pool.rb
70
+ - lib/concurrent/executor/ruby_single_thread_executor.rb
71
+ - lib/concurrent/executor/ruby_thread_pool_executor.rb
72
+ - lib/concurrent/executor/ruby_thread_pool_worker.rb
73
+ - lib/concurrent/executor/safe_task_executor.rb
74
+ - lib/concurrent/executor/single_thread_executor.rb
75
+ - lib/concurrent/executor/thread_pool_executor.rb
76
+ - lib/concurrent/executor/timer_set.rb
77
+ - lib/concurrent/executors.rb
51
78
  - lib/concurrent/future.rb
52
- - lib/concurrent/immediate_executor.rb
53
79
  - lib/concurrent/ivar.rb
54
- - lib/concurrent/java_cached_thread_pool.rb
55
- - lib/concurrent/java_fixed_thread_pool.rb
56
- - lib/concurrent/java_thread_pool_executor.rb
57
80
  - lib/concurrent/mvar.rb
58
81
  - lib/concurrent/obligation.rb
59
- - lib/concurrent/per_thread_executor.rb
60
- - lib/concurrent/postable.rb
61
- - lib/concurrent/processor_count.rb
82
+ - lib/concurrent/observable.rb
83
+ - lib/concurrent/options_parser.rb
62
84
  - lib/concurrent/promise.rb
63
- - lib/concurrent/ruby_cached_thread_pool.rb
64
- - lib/concurrent/ruby_fixed_thread_pool.rb
65
- - lib/concurrent/ruby_thread_pool_executor.rb
66
- - lib/concurrent/ruby_thread_pool_worker.rb
67
85
  - lib/concurrent/runnable.rb
68
- - lib/concurrent/safe_task_executor.rb
69
86
  - lib/concurrent/scheduled_task.rb
70
- - lib/concurrent/simple_actor_ref.rb
71
87
  - lib/concurrent/stoppable.rb
72
88
  - lib/concurrent/supervisor.rb
73
- - lib/concurrent/thread_local_var.rb
74
- - lib/concurrent/thread_pool_executor.rb
75
89
  - lib/concurrent/timer_task.rb
76
90
  - lib/concurrent/tvar.rb
77
91
  - lib/concurrent/utilities.rb
92
+ - lib/concurrent/utility/processor_count.rb
93
+ - lib/concurrent/utility/timeout.rb
94
+ - lib/concurrent/utility/timer.rb
78
95
  - lib/concurrent/version.rb
79
96
  - lib/concurrent_ruby.rb
80
- - spec/concurrent/actor_context_spec.rb
81
- - spec/concurrent/actor_ref_shared.rb
82
- - spec/concurrent/actor_spec.rb
97
+ - lib/concurrent_ruby_ext.bundle
98
+ - spec/concurrent/actor/actor_context_spec.rb
99
+ - spec/concurrent/actor/actor_ref_shared.rb
100
+ - spec/concurrent/actor/actor_spec.rb
101
+ - spec/concurrent/actor/postable_shared.rb
102
+ - spec/concurrent/actor/simple_actor_ref_spec.rb
83
103
  - spec/concurrent/agent_spec.rb
84
104
  - spec/concurrent/async_spec.rb
85
- - spec/concurrent/atomic_spec.rb
86
- - spec/concurrent/cached_thread_pool_shared.rb
87
- - spec/concurrent/channel/blocking_ring_buffer_spec.rb
105
+ - spec/concurrent/atomic/atomic_boolean_spec.rb
106
+ - spec/concurrent/atomic/atomic_fixnum_spec.rb
107
+ - spec/concurrent/atomic/condition_spec.rb
108
+ - spec/concurrent/atomic/copy_on_notify_observer_set_spec.rb
109
+ - spec/concurrent/atomic/copy_on_write_observer_set_spec.rb
110
+ - spec/concurrent/atomic/count_down_latch_spec.rb
111
+ - spec/concurrent/atomic/cyclic_barrier_spec.rb
112
+ - spec/concurrent/atomic/event_spec.rb
113
+ - spec/concurrent/atomic/observer_set_shared.rb
114
+ - spec/concurrent/atomic/thread_local_var_spec.rb
88
115
  - spec/concurrent/channel/buffered_channel_spec.rb
89
116
  - spec/concurrent/channel/channel_spec.rb
90
117
  - spec/concurrent/channel/probe_spec.rb
91
- - spec/concurrent/channel/ring_buffer_spec.rb
92
118
  - spec/concurrent/channel/unbuffered_channel_spec.rb
93
- - spec/concurrent/condition_spec.rb
119
+ - spec/concurrent/collection/blocking_ring_buffer_spec.rb
120
+ - spec/concurrent/collection/priority_queue_spec.rb
121
+ - spec/concurrent/collection/ring_buffer_spec.rb
94
122
  - spec/concurrent/configuration_spec.rb
95
- - spec/concurrent/copy_on_notify_observer_set_spec.rb
96
- - spec/concurrent/copy_on_write_observer_set_spec.rb
97
- - spec/concurrent/count_down_latch_spec.rb
98
123
  - spec/concurrent/dataflow_spec.rb
99
124
  - spec/concurrent/delay_spec.rb
100
125
  - spec/concurrent/dereferenceable_shared.rb
101
- - spec/concurrent/event_spec.rb
102
126
  - spec/concurrent/exchanger_spec.rb
103
- - spec/concurrent/fixed_thread_pool_shared.rb
127
+ - spec/concurrent/executor/cached_thread_pool_shared.rb
128
+ - spec/concurrent/executor/fixed_thread_pool_shared.rb
129
+ - spec/concurrent/executor/global_thread_pool_shared.rb
130
+ - spec/concurrent/executor/immediate_executor_spec.rb
131
+ - spec/concurrent/executor/java_cached_thread_pool_spec.rb
132
+ - spec/concurrent/executor/java_fixed_thread_pool_spec.rb
133
+ - spec/concurrent/executor/java_single_thread_executor_spec.rb
134
+ - spec/concurrent/executor/java_thread_pool_executor_spec.rb
135
+ - spec/concurrent/executor/per_thread_executor_spec.rb
136
+ - spec/concurrent/executor/ruby_cached_thread_pool_spec.rb
137
+ - spec/concurrent/executor/ruby_fixed_thread_pool_spec.rb
138
+ - spec/concurrent/executor/ruby_single_thread_executor_spec.rb
139
+ - spec/concurrent/executor/ruby_thread_pool_executor_spec.rb
140
+ - spec/concurrent/executor/safe_task_executor_spec.rb
141
+ - spec/concurrent/executor/thread_pool_class_cast_spec.rb
142
+ - spec/concurrent/executor/thread_pool_executor_shared.rb
143
+ - spec/concurrent/executor/thread_pool_shared.rb
144
+ - spec/concurrent/executor/timer_set_spec.rb
104
145
  - spec/concurrent/future_spec.rb
105
- - spec/concurrent/global_thread_pool_shared.rb
106
- - spec/concurrent/immediate_executor_spec.rb
107
146
  - spec/concurrent/ivar_spec.rb
108
- - spec/concurrent/java_cached_thread_pool_spec.rb
109
- - spec/concurrent/java_fixed_thread_pool_spec.rb
110
- - spec/concurrent/java_thread_pool_executor_spec.rb
111
147
  - spec/concurrent/mvar_spec.rb
112
148
  - spec/concurrent/obligation_shared.rb
113
149
  - spec/concurrent/obligation_spec.rb
114
- - spec/concurrent/observer_set_shared.rb
115
- - spec/concurrent/per_thread_executor_spec.rb
116
- - spec/concurrent/postable_shared.rb
117
- - spec/concurrent/processor_count_spec.rb
150
+ - spec/concurrent/observable_shared.rb
151
+ - spec/concurrent/observable_spec.rb
152
+ - spec/concurrent/options_parser_spec.rb
118
153
  - spec/concurrent/promise_spec.rb
119
- - spec/concurrent/ruby_cached_thread_pool_spec.rb
120
- - spec/concurrent/ruby_fixed_thread_pool_spec.rb
121
- - spec/concurrent/ruby_thread_pool_executor_spec.rb
122
154
  - spec/concurrent/runnable_shared.rb
123
155
  - spec/concurrent/runnable_spec.rb
124
- - spec/concurrent/safe_task_executor_spec.rb
125
156
  - spec/concurrent/scheduled_task_spec.rb
126
- - spec/concurrent/simple_actor_ref_spec.rb
127
157
  - spec/concurrent/stoppable_shared.rb
128
158
  - spec/concurrent/supervisor_spec.rb
129
- - spec/concurrent/thread_local_var_spec.rb
130
- - spec/concurrent/thread_pool_class_cast_spec.rb
131
- - spec/concurrent/thread_pool_executor_shared.rb
132
- - spec/concurrent/thread_pool_shared.rb
133
159
  - spec/concurrent/timer_task_spec.rb
134
160
  - spec/concurrent/tvar_spec.rb
135
- - spec/concurrent/utilities_spec.rb
161
+ - spec/concurrent/utility/processor_count_spec.rb
162
+ - spec/concurrent/utility/timeout_spec.rb
163
+ - spec/concurrent/utility/timer_spec.rb
136
164
  - spec/spec_helper.rb
137
165
  - spec/support/functions.rb
138
166
  - spec/support/less_than_or_equal_to_matcher.rb
@@ -140,84 +168,95 @@ homepage: http://www.concurrent-ruby.com
140
168
  licenses:
141
169
  - MIT
142
170
  metadata: {}
143
- post_install_message:
171
+ post_install_message:
144
172
  rdoc_options: []
145
173
  require_paths:
146
174
  - lib
147
175
  required_ruby_version: !ruby/object:Gem::Requirement
148
176
  requirements:
149
- - - '>='
177
+ - - ">="
150
178
  - !ruby/object:Gem::Version
151
179
  version: 1.9.3
152
180
  required_rubygems_version: !ruby/object:Gem::Requirement
153
181
  requirements:
154
- - - '>'
182
+ - - ">"
155
183
  - !ruby/object:Gem::Version
156
184
  version: 1.3.1
157
185
  requirements: []
158
- rubyforge_project:
186
+ rubyforge_project:
159
187
  rubygems_version: 2.2.2
160
- signing_key:
188
+ signing_key:
161
189
  specification_version: 4
162
- summary: Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell, F#, C#, Java, and classic concurrency patterns.
190
+ summary: Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell,
191
+ F#, C#, Java, and classic concurrency patterns.
163
192
  test_files:
164
- - spec/spec_helper.rb
165
- - spec/concurrent/actor_context_spec.rb
166
- - spec/concurrent/actor_ref_shared.rb
167
- - spec/concurrent/actor_spec.rb
193
+ - spec/concurrent/actor/actor_context_spec.rb
194
+ - spec/concurrent/actor/actor_ref_shared.rb
195
+ - spec/concurrent/actor/actor_spec.rb
196
+ - spec/concurrent/actor/postable_shared.rb
197
+ - spec/concurrent/actor/simple_actor_ref_spec.rb
168
198
  - spec/concurrent/agent_spec.rb
169
199
  - spec/concurrent/async_spec.rb
170
- - spec/concurrent/atomic_spec.rb
171
- - spec/concurrent/cached_thread_pool_shared.rb
172
- - spec/concurrent/condition_spec.rb
200
+ - spec/concurrent/atomic/atomic_boolean_spec.rb
201
+ - spec/concurrent/atomic/atomic_fixnum_spec.rb
202
+ - spec/concurrent/atomic/condition_spec.rb
203
+ - spec/concurrent/atomic/copy_on_notify_observer_set_spec.rb
204
+ - spec/concurrent/atomic/copy_on_write_observer_set_spec.rb
205
+ - spec/concurrent/atomic/count_down_latch_spec.rb
206
+ - spec/concurrent/atomic/cyclic_barrier_spec.rb
207
+ - spec/concurrent/atomic/event_spec.rb
208
+ - spec/concurrent/atomic/observer_set_shared.rb
209
+ - spec/concurrent/atomic/thread_local_var_spec.rb
210
+ - spec/concurrent/channel/buffered_channel_spec.rb
211
+ - spec/concurrent/channel/channel_spec.rb
212
+ - spec/concurrent/channel/probe_spec.rb
213
+ - spec/concurrent/channel/unbuffered_channel_spec.rb
214
+ - spec/concurrent/collection/blocking_ring_buffer_spec.rb
215
+ - spec/concurrent/collection/priority_queue_spec.rb
216
+ - spec/concurrent/collection/ring_buffer_spec.rb
173
217
  - spec/concurrent/configuration_spec.rb
174
- - spec/concurrent/copy_on_notify_observer_set_spec.rb
175
- - spec/concurrent/copy_on_write_observer_set_spec.rb
176
- - spec/concurrent/count_down_latch_spec.rb
177
218
  - spec/concurrent/dataflow_spec.rb
178
219
  - spec/concurrent/delay_spec.rb
179
220
  - spec/concurrent/dereferenceable_shared.rb
180
- - spec/concurrent/event_spec.rb
181
221
  - spec/concurrent/exchanger_spec.rb
182
- - spec/concurrent/fixed_thread_pool_shared.rb
222
+ - spec/concurrent/executor/cached_thread_pool_shared.rb
223
+ - spec/concurrent/executor/fixed_thread_pool_shared.rb
224
+ - spec/concurrent/executor/global_thread_pool_shared.rb
225
+ - spec/concurrent/executor/immediate_executor_spec.rb
226
+ - spec/concurrent/executor/java_cached_thread_pool_spec.rb
227
+ - spec/concurrent/executor/java_fixed_thread_pool_spec.rb
228
+ - spec/concurrent/executor/java_single_thread_executor_spec.rb
229
+ - spec/concurrent/executor/java_thread_pool_executor_spec.rb
230
+ - spec/concurrent/executor/per_thread_executor_spec.rb
231
+ - spec/concurrent/executor/ruby_cached_thread_pool_spec.rb
232
+ - spec/concurrent/executor/ruby_fixed_thread_pool_spec.rb
233
+ - spec/concurrent/executor/ruby_single_thread_executor_spec.rb
234
+ - spec/concurrent/executor/ruby_thread_pool_executor_spec.rb
235
+ - spec/concurrent/executor/safe_task_executor_spec.rb
236
+ - spec/concurrent/executor/thread_pool_class_cast_spec.rb
237
+ - spec/concurrent/executor/thread_pool_executor_shared.rb
238
+ - spec/concurrent/executor/thread_pool_shared.rb
239
+ - spec/concurrent/executor/timer_set_spec.rb
183
240
  - spec/concurrent/future_spec.rb
184
- - spec/concurrent/global_thread_pool_shared.rb
185
- - spec/concurrent/immediate_executor_spec.rb
186
241
  - spec/concurrent/ivar_spec.rb
187
- - spec/concurrent/java_cached_thread_pool_spec.rb
188
- - spec/concurrent/java_fixed_thread_pool_spec.rb
189
- - spec/concurrent/java_thread_pool_executor_spec.rb
190
242
  - spec/concurrent/mvar_spec.rb
191
243
  - spec/concurrent/obligation_shared.rb
192
244
  - spec/concurrent/obligation_spec.rb
193
- - spec/concurrent/observer_set_shared.rb
194
- - spec/concurrent/per_thread_executor_spec.rb
195
- - spec/concurrent/postable_shared.rb
196
- - spec/concurrent/processor_count_spec.rb
245
+ - spec/concurrent/observable_shared.rb
246
+ - spec/concurrent/observable_spec.rb
247
+ - spec/concurrent/options_parser_spec.rb
197
248
  - spec/concurrent/promise_spec.rb
198
- - spec/concurrent/ruby_cached_thread_pool_spec.rb
199
- - spec/concurrent/ruby_fixed_thread_pool_spec.rb
200
- - spec/concurrent/ruby_thread_pool_executor_spec.rb
201
249
  - spec/concurrent/runnable_shared.rb
202
250
  - spec/concurrent/runnable_spec.rb
203
- - spec/concurrent/safe_task_executor_spec.rb
204
251
  - spec/concurrent/scheduled_task_spec.rb
205
- - spec/concurrent/simple_actor_ref_spec.rb
206
252
  - spec/concurrent/stoppable_shared.rb
207
253
  - spec/concurrent/supervisor_spec.rb
208
- - spec/concurrent/thread_local_var_spec.rb
209
- - spec/concurrent/thread_pool_class_cast_spec.rb
210
- - spec/concurrent/thread_pool_executor_shared.rb
211
- - spec/concurrent/thread_pool_shared.rb
212
254
  - spec/concurrent/timer_task_spec.rb
213
255
  - spec/concurrent/tvar_spec.rb
214
- - spec/concurrent/utilities_spec.rb
215
- - spec/concurrent/channel/blocking_ring_buffer_spec.rb
216
- - spec/concurrent/channel/buffered_channel_spec.rb
217
- - spec/concurrent/channel/channel_spec.rb
218
- - spec/concurrent/channel/probe_spec.rb
219
- - spec/concurrent/channel/ring_buffer_spec.rb
220
- - spec/concurrent/channel/unbuffered_channel_spec.rb
256
+ - spec/concurrent/utility/processor_count_spec.rb
257
+ - spec/concurrent/utility/timeout_spec.rb
258
+ - spec/concurrent/utility/timer_spec.rb
259
+ - spec/spec_helper.rb
221
260
  - spec/support/functions.rb
222
261
  - spec/support/less_than_or_equal_to_matcher.rb
223
- has_rdoc:
262
+ has_rdoc:
@@ -1,31 +0,0 @@
1
- require 'concurrent/simple_actor_ref'
2
-
3
- module Concurrent
4
-
5
- module ActorContext
6
-
7
- def on_start
8
- end
9
-
10
- def on_reset
11
- end
12
-
13
- def on_shutdown
14
- end
15
-
16
- def on_error(time, message, exception)
17
- end
18
-
19
- def self.included(base)
20
-
21
- class << base
22
- protected :new
23
-
24
- def spawn(opts = {})
25
- args = opts.fetch(:args, [])
26
- Concurrent::SimpleActorRef.new(self.new(*args), opts)
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,39 +0,0 @@
1
- require 'concurrent/copy_on_notify_observer_set'
2
-
3
- module Concurrent
4
-
5
- module ActorRef
6
-
7
- #NOTE: Required API methods
8
- # Must be implemented in all subclasses
9
- #def post(*msg, &block)
10
- #def post!(*msg)
11
- #def running?
12
- #def shutdown?
13
- #def shutdown
14
- #def join(timeout = nil)
15
-
16
- def <<(message)
17
- post(*message)
18
- self
19
- end
20
-
21
- def add_observer(*args)
22
- @observers.add_observer(*args)
23
- end
24
-
25
- def delete_observer(*args)
26
- @observers.delete_observer(*args)
27
- end
28
-
29
- def delete_observers
30
- @observers.delete_observers
31
- end
32
-
33
- protected
34
-
35
- def observers
36
- @observers ||= CopyOnNotifyObserverSet.new
37
- end
38
- end
39
- end
@@ -1,121 +0,0 @@
1
- module Concurrent
2
-
3
- # @!visibility private
4
- module MutexAtomicFixnum # :nodoc:
5
-
6
- def allocate_storage(init)
7
- @value = init
8
- @mutex = Mutex.new
9
- end
10
-
11
- def value
12
- @mutex.synchronize do
13
- @value
14
- end
15
- end
16
-
17
- def value=(value)
18
- raise ArgumentError.new('value must be a Fixnum') unless value.is_a?(Fixnum)
19
- @mutex.synchronize do
20
- @value = value
21
- end
22
- end
23
-
24
- def increment
25
- @mutex.synchronize do
26
- @value += 1
27
- end
28
- end
29
-
30
- def decrement
31
- @mutex.synchronize do
32
- @value -= 1
33
- end
34
- end
35
-
36
- def compare_and_set(expect, update)
37
- @mutex.synchronize do
38
- if @value == expect
39
- @value = update
40
- true
41
- else
42
- false
43
- end
44
- end
45
- end
46
- end
47
-
48
- # @!visibility private
49
- module JavaAtomicFixnum # :nodoc:
50
-
51
- def allocate_storage(init)
52
- @atomic = java.util.concurrent.atomic.AtomicLong.new(init)
53
- end
54
-
55
- def value
56
- @atomic.get
57
- end
58
-
59
- def value=(value)
60
- raise ArgumentError.new('value must be a Fixnum') unless value.is_a?(Fixnum)
61
- @atomic.set(value)
62
- end
63
-
64
- def increment
65
- @atomic.increment_and_get
66
- end
67
-
68
- def decrement
69
- @atomic.decrement_and_get
70
- end
71
-
72
- def compare_and_set(expect, update)
73
- @atomic.compare_and_set(expect, update)
74
- end
75
- end
76
-
77
- # A numeric value that can be updated atomically. Reads and writes to an atomic
78
- # fixnum and thread-safe and guaranteed to succeed. Reads and writes may block
79
- # briefly but no explicit locking is required.
80
- #
81
- # @!method value()
82
- # Retrieves the current +Fixnum+ value
83
- # @return [Fixnum] the current value
84
- #
85
- # @!method value=(value)
86
- # Explicitly sets the value
87
- # @param [Fixnum] value the new value to be set
88
- # @return [Fixnum] the current value
89
- # @raise [ArgumentError] if the new value is not a +Fixnum+
90
- #
91
- # @!method increment()
92
- # Increases the current value by 1
93
- # @return [Fixnum] the current value after incrementation
94
- #
95
- # @!method decrement()
96
- # Decreases the current value by 1
97
- # @return [Fixnum] the current value after decrementation
98
- #
99
- # @since 0.5.0
100
- # @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicLong.html java.util.concurrent.atomic.AtomicLong
101
- class AtomicFixnum
102
-
103
- # Creates a new +AtomicFixnum+ with the given initial value.
104
- #
105
- # @param [Fixnum] init the initial value
106
- # @raise [ArgumentError] if the initial value is not a +Fixnum+
107
- def initialize(init = 0)
108
- raise ArgumentError.new('initial value must be a Fixnum') unless init.is_a?(Fixnum)
109
- allocate_storage(init)
110
- end
111
-
112
- if RUBY_PLATFORM == 'java'
113
- include JavaAtomicFixnum
114
- else
115
- include MutexAtomicFixnum
116
- end
117
-
118
- alias_method :up, :increment
119
- alias_method :down, :decrement
120
- end
121
- end