concurrent-ruby 0.6.0 → 0.7.0.rc0

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +55 -51
  3. data/lib/concurrent/actress/ad_hoc.rb +6 -0
  4. data/lib/concurrent/actress/context.rb +10 -8
  5. data/lib/concurrent/actress/core.rb +44 -20
  6. data/lib/concurrent/actress/core_delegations.rb +5 -0
  7. data/lib/concurrent/actress/envelope.rb +21 -5
  8. data/lib/concurrent/actress/reference.rb +5 -5
  9. data/lib/concurrent/actress.rb +152 -6
  10. data/lib/concurrent/agent.rb +9 -9
  11. data/lib/concurrent/atomic.rb +46 -0
  12. data/lib/concurrent/atomic_reference/concurrent_update_error.rb +7 -0
  13. data/lib/concurrent/atomic_reference/delegated_update.rb +28 -0
  14. data/lib/concurrent/atomic_reference/direct_update.rb +28 -0
  15. data/lib/concurrent/atomic_reference/jruby.rb +8 -0
  16. data/lib/concurrent/atomic_reference/mutex_atomic.rb +47 -0
  17. data/lib/concurrent/atomic_reference/numeric_cas_wrapper.rb +24 -0
  18. data/lib/concurrent/atomic_reference/rbx.rb +16 -0
  19. data/lib/concurrent/atomic_reference/ruby.rb +16 -0
  20. data/lib/concurrent/atomics.rb +1 -1
  21. data/lib/concurrent/configuration.rb +7 -2
  22. data/lib/concurrent/executor/ruby_thread_pool_executor.rb +0 -1
  23. data/lib/concurrent/executor/{one_by_one.rb → serialized_execution.rb} +21 -8
  24. data/lib/concurrent/executor/timer_set.rb +6 -1
  25. data/lib/concurrent/executors.rb +1 -1
  26. data/lib/concurrent/logging.rb +1 -1
  27. data/lib/concurrent/observable.rb +1 -1
  28. data/lib/concurrent/supervisor.rb +1 -1
  29. data/lib/concurrent/timer_task.rb +0 -36
  30. data/lib/concurrent/version.rb +1 -1
  31. data/lib/concurrent.rb +3 -4
  32. data/lib/concurrent_ruby_ext.so +0 -0
  33. data/lib/extension_helper.rb +9 -0
  34. metadata +19 -152
  35. data/lib/concurrent/actor/actor.rb +0 -270
  36. data/lib/concurrent/actor/postable.rb +0 -102
  37. data/lib/concurrent/actors.rb +0 -2
  38. data/lib/concurrent/actress/doc.md +0 -53
  39. data/lib/concurrent/atomic/atomic.rb +0 -48
  40. data/lib/concurrent/runnable.rb +0 -90
  41. data/lib/concurrent/stoppable.rb +0 -20
  42. data/spec/concurrent/actor/actor_spec.rb +0 -376
  43. data/spec/concurrent/actor/postable_shared.rb +0 -218
  44. data/spec/concurrent/actress_spec.rb +0 -191
  45. data/spec/concurrent/agent_spec.rb +0 -500
  46. data/spec/concurrent/async_spec.rb +0 -352
  47. data/spec/concurrent/atomic/atomic_boolean_spec.rb +0 -172
  48. data/spec/concurrent/atomic/atomic_fixnum_spec.rb +0 -186
  49. data/spec/concurrent/atomic/atomic_spec.rb +0 -133
  50. data/spec/concurrent/atomic/condition_spec.rb +0 -171
  51. data/spec/concurrent/atomic/copy_on_notify_observer_set_spec.rb +0 -10
  52. data/spec/concurrent/atomic/copy_on_write_observer_set_spec.rb +0 -10
  53. data/spec/concurrent/atomic/count_down_latch_spec.rb +0 -151
  54. data/spec/concurrent/atomic/cyclic_barrier_spec.rb +0 -248
  55. data/spec/concurrent/atomic/event_spec.rb +0 -200
  56. data/spec/concurrent/atomic/observer_set_shared.rb +0 -242
  57. data/spec/concurrent/atomic/thread_local_var_spec.rb +0 -113
  58. data/spec/concurrent/channel/buffered_channel_spec.rb +0 -151
  59. data/spec/concurrent/channel/channel_spec.rb +0 -39
  60. data/spec/concurrent/channel/probe_spec.rb +0 -77
  61. data/spec/concurrent/channel/unbuffered_channel_spec.rb +0 -132
  62. data/spec/concurrent/collection/blocking_ring_buffer_spec.rb +0 -149
  63. data/spec/concurrent/collection/priority_queue_spec.rb +0 -317
  64. data/spec/concurrent/collection/ring_buffer_spec.rb +0 -126
  65. data/spec/concurrent/configuration_spec.rb +0 -71
  66. data/spec/concurrent/dataflow_spec.rb +0 -242
  67. data/spec/concurrent/delay_spec.rb +0 -91
  68. data/spec/concurrent/dereferenceable_shared.rb +0 -146
  69. data/spec/concurrent/exchanger_spec.rb +0 -66
  70. data/spec/concurrent/executor/cached_thread_pool_shared.rb +0 -115
  71. data/spec/concurrent/executor/fixed_thread_pool_shared.rb +0 -136
  72. data/spec/concurrent/executor/global_thread_pool_shared.rb +0 -35
  73. data/spec/concurrent/executor/immediate_executor_spec.rb +0 -12
  74. data/spec/concurrent/executor/java_cached_thread_pool_spec.rb +0 -44
  75. data/spec/concurrent/executor/java_fixed_thread_pool_spec.rb +0 -64
  76. data/spec/concurrent/executor/java_single_thread_executor_spec.rb +0 -21
  77. data/spec/concurrent/executor/java_thread_pool_executor_spec.rb +0 -71
  78. data/spec/concurrent/executor/per_thread_executor_spec.rb +0 -57
  79. data/spec/concurrent/executor/ruby_cached_thread_pool_spec.rb +0 -69
  80. data/spec/concurrent/executor/ruby_fixed_thread_pool_spec.rb +0 -39
  81. data/spec/concurrent/executor/ruby_single_thread_executor_spec.rb +0 -18
  82. data/spec/concurrent/executor/ruby_thread_pool_executor_spec.rb +0 -171
  83. data/spec/concurrent/executor/safe_task_executor_spec.rb +0 -103
  84. data/spec/concurrent/executor/thread_pool_class_cast_spec.rb +0 -52
  85. data/spec/concurrent/executor/thread_pool_executor_shared.rb +0 -155
  86. data/spec/concurrent/executor/thread_pool_shared.rb +0 -239
  87. data/spec/concurrent/executor/timer_set_spec.rb +0 -183
  88. data/spec/concurrent/future_spec.rb +0 -329
  89. data/spec/concurrent/ivar_spec.rb +0 -215
  90. data/spec/concurrent/mvar_spec.rb +0 -380
  91. data/spec/concurrent/obligation_shared.rb +0 -102
  92. data/spec/concurrent/obligation_spec.rb +0 -282
  93. data/spec/concurrent/observable_shared.rb +0 -177
  94. data/spec/concurrent/observable_spec.rb +0 -56
  95. data/spec/concurrent/options_parser_spec.rb +0 -71
  96. data/spec/concurrent/promise_spec.rb +0 -367
  97. data/spec/concurrent/runnable_shared.rb +0 -68
  98. data/spec/concurrent/runnable_spec.rb +0 -235
  99. data/spec/concurrent/scheduled_task_spec.rb +0 -342
  100. data/spec/concurrent/stoppable_shared.rb +0 -37
  101. data/spec/concurrent/supervisor_spec.rb +0 -1148
  102. data/spec/concurrent/timer_task_spec.rb +0 -258
  103. data/spec/concurrent/tvar_spec.rb +0 -137
  104. data/spec/concurrent/utility/processor_count_spec.rb +0 -20
  105. data/spec/concurrent/utility/timeout_spec.rb +0 -50
  106. data/spec/concurrent/utility/timer_spec.rb +0 -52
  107. data/spec/spec_helper.rb +0 -31
  108. data/spec/support/example_group_extensions.rb +0 -48
  109. data/spec/support/less_than_or_equal_to_matcher.rb +0 -5
  110. /data/{LICENSE → LICENSE.txt} +0 -0
@@ -1,258 +0,0 @@
1
- require 'spec_helper'
2
- require_relative 'dereferenceable_shared'
3
- require_relative 'observable_shared'
4
-
5
- module Concurrent
6
-
7
- describe TimerTask do
8
- with_full_reset
9
-
10
- before(:each) do
11
- # suppress deprecation warnings.
12
- Concurrent::TimerTask.any_instance.stub(:warn)
13
- Concurrent::TimerTask.stub(:warn)
14
- end
15
-
16
- context :dereferenceable do
17
-
18
- after(:each) do
19
- begin
20
- @subject.kill if @subject
21
- rescue Exception => ex
22
- # prevent exceptions with mocks in tests
23
- end
24
- end
25
-
26
- def dereferenceable_subject(value, opts = {})
27
- opts = opts.merge(execution_interval: 0.1, run_now: true)
28
- @subject = TimerTask.new(opts) { value }.execute.tap { sleep(0.1) }
29
- end
30
-
31
- def dereferenceable_observable(opts = {})
32
- opts = opts.merge(execution_interval: 0.1, run_now: true)
33
- @subject = TimerTask.new(opts) { 'value' }
34
- end
35
-
36
- def execute_dereferenceable(subject)
37
- subject.execute
38
- sleep(0.1)
39
- end
40
-
41
- it_should_behave_like :dereferenceable
42
- end
43
-
44
- context :observable do
45
-
46
- subject { TimerTask.new(execution_interval: 0.1) { nil } }
47
-
48
- after(:each) { subject.kill }
49
-
50
- def trigger_observable(observable)
51
- observable.execute
52
- sleep(0.2)
53
- end
54
-
55
- it_should_behave_like :observable
56
- end
57
-
58
- context 'created with #new' do
59
-
60
- context '#initialize' do
61
-
62
- it 'raises an exception if no block given' do
63
- lambda {
64
- Concurrent::TimerTask.new
65
- }.should raise_error(ArgumentError)
66
- end
67
-
68
- it 'raises an exception if :execution_interval is not greater than zero' do
69
- lambda {
70
- Concurrent::TimerTask.new(execution_interval: 0) { nil }
71
- }.should raise_error(ArgumentError)
72
- end
73
-
74
- it 'raises an exception if :execution_interval is not an integer' do
75
- lambda {
76
- Concurrent::TimerTask.new(execution_interval: 'one') { nil }
77
- }.should raise_error(ArgumentError)
78
- end
79
-
80
- it 'raises an exception if :timeout_interval is not greater than zero' do
81
- lambda {
82
- Concurrent::TimerTask.new(timeout_interval: 0) { nil }
83
- }.should raise_error(ArgumentError)
84
- end
85
-
86
- it 'raises an exception if :timeout_interval is not an integer' do
87
- lambda {
88
- Concurrent::TimerTask.new(timeout_interval: 'one') { nil }
89
- }.should raise_error(ArgumentError)
90
- end
91
-
92
- it 'uses the default execution interval when no interval is given' do
93
- subject = TimerTask.new { nil }
94
- subject.execution_interval.should eq TimerTask::EXECUTION_INTERVAL
95
- end
96
-
97
- it 'uses the default timeout interval when no interval is given' do
98
- subject = TimerTask.new { nil }
99
- subject.timeout_interval.should eq TimerTask::TIMEOUT_INTERVAL
100
- end
101
-
102
- it 'uses the given execution interval' do
103
- subject = TimerTask.new(execution_interval: 5) { nil }
104
- subject.execution_interval.should eq 5
105
- end
106
-
107
- it 'uses the given timeout interval' do
108
- subject = TimerTask.new(timeout_interval: 5) { nil }
109
- subject.timeout_interval.should eq 5
110
- end
111
- end
112
-
113
- context '#kill' do
114
-
115
- it 'returns true on success' do
116
- task = TimerTask.execute(run_now: false) { nil }
117
- sleep(0.1)
118
- task.kill.should be_true
119
- end
120
- end
121
- end
122
-
123
- context 'arguments' do
124
-
125
- it 'raises an exception if no block given' do
126
- lambda {
127
- Concurrent::TimerTask.execute
128
- }.should raise_error
129
- end
130
-
131
- specify '#execution_interval is writeable' do
132
-
133
- latch = CountDownLatch.new(1)
134
- subject = TimerTask.new(execution_interval: 1) do |task|
135
- task.execution_interval = 3
136
- latch.count_down
137
- end
138
-
139
- subject.execution_interval.should == 1
140
- subject.execution_interval = 0.1
141
- subject.execution_interval.should == 0.1
142
-
143
- subject.execute
144
- latch.wait(0.2)
145
-
146
- subject.execution_interval.should == 3
147
- subject.kill
148
- end
149
-
150
- specify '#execution_interval is writeable' do
151
-
152
- latch = CountDownLatch.new(1)
153
- subject = TimerTask.new(timeout_interval: 1, execution_interval: 0.1) do |task|
154
- task.timeout_interval = 3
155
- latch.count_down
156
- end
157
-
158
- subject.timeout_interval.should == 1
159
- subject.timeout_interval = 2
160
- subject.timeout_interval.should == 2
161
-
162
- subject.execute
163
- latch.wait(0.2)
164
-
165
- subject.timeout_interval.should == 3
166
- subject.kill
167
- end
168
- end
169
-
170
- context 'execution' do
171
-
172
- it 'runs the block immediately when the :run_now option is true' do
173
- latch = CountDownLatch.new(1)
174
- subject = TimerTask.execute(execution: 500, now: true) { latch.count_down }
175
- latch.wait(1).should be_true
176
- subject.kill
177
- end
178
-
179
- it 'waits for :execution_interval seconds when the :run_now option is false' do
180
- latch = CountDownLatch.new(1)
181
- subject = TimerTask.execute(execution: 0.1, now: false) { latch.count_down }
182
- latch.count.should eq 1
183
- latch.wait(1).should be_true
184
- subject.kill
185
- end
186
-
187
- it 'waits for :execution_interval seconds when the :run_now option is not given' do
188
- latch = CountDownLatch.new(1)
189
- subject = TimerTask.execute(execution: 0.1, now: false) { latch.count_down }
190
- latch.count.should eq 1
191
- latch.wait(1).should be_true
192
- subject.kill
193
- end
194
-
195
- it 'passes a "self" reference to the block as the sole argument' do
196
- expected = nil
197
- latch = CountDownLatch.new(1)
198
- subject = TimerTask.new(execution_interval: 1, run_now: true) do |task|
199
- expected = task
200
- latch.sount_down
201
- end
202
- subject.execute
203
- latch.wait(1)
204
- expected.should eq subject
205
- subject.kill
206
- end
207
- end
208
-
209
- context 'observation' do
210
-
211
- let(:observer) do
212
- Class.new do
213
- attr_reader :time
214
- attr_reader :value
215
- attr_reader :ex
216
- attr_reader :latch
217
- define_method(:initialize) { @latch = CountDownLatch.new(1) }
218
- define_method(:update) do |time, value, ex|
219
- @time = time
220
- @value = value
221
- @ex = ex
222
- @latch.count_down
223
- end
224
- end.new
225
- end
226
-
227
- it 'notifies all observers on success' do
228
- subject = TimerTask.new(execution: 0.1) { 42 }
229
- subject.add_observer(observer)
230
- subject.execute
231
- observer.latch.wait(1)
232
- observer.value.should == 42
233
- observer.ex.should be_nil
234
- subject.kill
235
- end
236
-
237
- it 'notifies all observers on timeout' do
238
- subject = TimerTask.new(execution: 0.1, timeout: 0.1) { sleep }
239
- subject.add_observer(observer)
240
- subject.execute
241
- observer.latch.wait(1)
242
- observer.value.should be_nil
243
- observer.ex.should be_a(Concurrent::TimeoutError)
244
- subject.kill
245
- end
246
-
247
- it 'notifies all observers on error' do
248
- subject = TimerTask.new(execution: 0.1) { raise ArgumentError }
249
- subject.add_observer(observer)
250
- subject.execute
251
- observer.latch.wait(1)
252
- observer.value.should be_nil
253
- observer.ex.should be_a(ArgumentError)
254
- subject.kill
255
- end
256
- end
257
- end
258
- end
@@ -1,137 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Concurrent
4
-
5
- describe TVar do
6
-
7
- context '#initialize' do
8
-
9
- it 'accepts an initial value' do
10
- t = TVar.new(14)
11
- t.value.should eq 14
12
- end
13
-
14
- end
15
-
16
- context '#value' do
17
-
18
- it 'gets the value' do
19
- t = TVar.new(14)
20
- t.value.should eq 14
21
- end
22
-
23
- end
24
-
25
- context '#value=' do
26
-
27
- it 'sets the value' do
28
- t = TVar.new(14)
29
- t.value = 2
30
- t.value.should eq 2
31
- end
32
-
33
- end
34
-
35
- end
36
-
37
- describe '#atomically' do
38
-
39
- it 'raises an exception when no block given' do
40
- expect { Concurrent::atomically }.to raise_error(ArgumentError)
41
- end
42
-
43
- it 'retries on abort' do
44
- count = 0
45
-
46
- Concurrent::atomically do
47
- if count == 0
48
- count = 1
49
- Concurrent::abort_transaction
50
- else
51
- count = 2
52
- end
53
- end
54
-
55
- count.should eq 2
56
- end
57
-
58
- it 'commits writes if the transaction succeeds' do
59
- t = TVar.new(0)
60
-
61
- Concurrent::atomically do
62
- t.value = 1
63
- end
64
-
65
- t.value.should eq 1
66
- end
67
-
68
- it 'undoes writes if the transaction is aborted' do
69
- t = TVar.new(0)
70
-
71
- count = 0
72
-
73
- Concurrent::atomically do
74
- if count == 0
75
- t.value = 1
76
- count = 1
77
- Concurrent::abort_transaction
78
- end
79
- end
80
-
81
- t.value.should eq 0
82
- end
83
-
84
- it 'provides atomicity' do
85
- t1 = TVar.new(0)
86
- t2 = TVar.new(0)
87
-
88
- count = 0
89
-
90
- Concurrent::atomically do
91
- if count == 0
92
- count = 1
93
- t1.value = 1
94
- Concurrent::abort_transaction
95
- t2.value = 2
96
- end
97
- end
98
-
99
- t1.value.should eq 0
100
- t2.value.should eq 0
101
- end
102
-
103
- it 'provides isolation' do
104
- t = TVar.new(0)
105
-
106
- Thread.new do
107
- Concurrent::atomically do
108
- t1.value = 1
109
- sleep(1)
110
- end
111
- end
112
-
113
- sleep(0.5)
114
-
115
- t.value.should eq 0
116
- end
117
-
118
- it 'nests' do
119
- Concurrent::atomically do
120
- Concurrent::atomically do
121
- Concurrent::atomically do
122
- end
123
- end
124
- end
125
- end
126
-
127
- end
128
-
129
- describe '#abort_transaction' do
130
-
131
- it 'raises an exception outside an #atomically block' do
132
- expect { Concurrent::abort_transaction }.to raise_error(Concurrent::Transaction::AbortError)
133
- end
134
-
135
- end
136
-
137
- end
@@ -1,20 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Concurrent
4
-
5
- describe '#processor_count' do
6
-
7
- it 'retuns a positive integer' do
8
- Concurrent::processor_count.should be_a Integer
9
- Concurrent::processor_count.should >= 1
10
- end
11
- end
12
-
13
- describe '#physical_processor_count' do
14
-
15
- it 'retuns a positive integer' do
16
- Concurrent::physical_processor_count.should be_a Integer
17
- Concurrent::physical_processor_count.should >= 1
18
- end
19
- end
20
- end
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Concurrent
4
-
5
- describe '#timeout' do
6
-
7
- it 'raises an exception if no block is given' do
8
- expect {
9
- Concurrent::timeout(1)
10
- }.to raise_error
11
- end
12
-
13
- it 'returns the value of the block on success' do
14
- result = Concurrent::timeout(1) { 42 }
15
- result.should eq 42
16
- end
17
-
18
- it 'raises an exception if the timeout value is reached' do
19
- expect {
20
- Concurrent::timeout(1){ sleep }
21
- }.to raise_error(Concurrent::TimeoutError)
22
- end
23
-
24
- it 'bubbles thread exceptions' do
25
- expect {
26
- Concurrent::timeout(1){ raise NotImplementedError }
27
- }.to raise_error
28
- end
29
-
30
- it 'kills the thread on success' do
31
- result = Concurrent::timeout(1) { 42 }
32
- Thread.should_receive(:kill).with(any_args())
33
- Concurrent::timeout(1){ 42 }
34
- end
35
-
36
- it 'kills the thread on timeout' do
37
- Thread.should_receive(:kill).with(any_args())
38
- expect {
39
- Concurrent::timeout(1){ sleep }
40
- }.to raise_error
41
- end
42
-
43
- it 'kills the thread on exception' do
44
- Thread.should_receive(:kill).with(any_args())
45
- expect {
46
- Concurrent::timeout(1){ raise NotImplementedError }
47
- }.to raise_error
48
- end
49
- end
50
- end
@@ -1,52 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Concurrent
4
-
5
- describe '#timer' do
6
-
7
- it 'raises an exception when no block given' do
8
- expect {
9
- Concurrent::timer(0.1)
10
- }.to raise_error(ArgumentError)
11
- end
12
-
13
- it 'raises an exception if the interval is less than 0 seconds' do
14
- expect {
15
- Concurrent::timer(-1){ :foo }
16
- }.to raise_error(ArgumentError)
17
- end
18
-
19
- it 'executes the block after the given number of seconds' do
20
- start = Time.now.to_f
21
- latch = CountDownLatch.new(1)
22
- Concurrent::timer(0.5){ latch.count_down }
23
- latch.count.should eq 1
24
- latch.wait(0.1)
25
- latch.count.should eq 1
26
- latch.wait(1)
27
- latch.count.should eq 0
28
- end
29
-
30
- it 'suppresses exceptions thrown by the block' do
31
- expect {
32
- Concurrent::timer(0.5){ raise Exception }
33
- }.to_not raise_error
34
- end
35
-
36
- it 'passes all arguments to the block' do
37
- expected = nil
38
- latch = CountDownLatch.new(1)
39
- Concurrent::timer(0, 1, 2, 3) do |*args|
40
- expected = args
41
- latch.count_down
42
- end
43
- latch.wait(0.2)
44
- expected.should eq [1, 2, 3]
45
- end
46
-
47
- it 'runs the task on the global timer pool' do
48
- Concurrent.configuration.global_timer_set.should_receive(:post).with(0.1)
49
- Concurrent::timer(0.1){ :foo }
50
- end
51
- end
52
- end
data/spec/spec_helper.rb DELETED
@@ -1,31 +0,0 @@
1
- require 'simplecov'
2
- require 'coveralls'
3
-
4
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
- SimpleCov::Formatter::HTMLFormatter,
6
- Coveralls::SimpleCov::Formatter
7
- ]
8
-
9
- SimpleCov.start do
10
- project_name 'concurrent-ruby'
11
- add_filter '/coverage/'
12
- add_filter '/doc/'
13
- add_filter '/pkg/'
14
- add_filter '/spec/'
15
- add_filter '/tasks/'
16
- end
17
-
18
- require 'concurrent'
19
-
20
- logger = Logger.new($stderr)
21
- logger.level = Logger::INFO
22
- Concurrent.configuration.logger = lambda do |level, progname, message = nil, &block|
23
- logger.add level, message, progname, &block
24
- end
25
-
26
- # import all the support files
27
- Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require File.expand_path(f) }
28
-
29
- RSpec.configure do |config|
30
- config.order = 'random'
31
- end
@@ -1,48 +0,0 @@
1
- require 'rbconfig'
2
-
3
- module Concurrent
4
- module TestHelpers
5
- def delta(v1, v2)
6
- if block_given?
7
- v1 = yield(v1)
8
- v2 = yield(v2)
9
- end
10
- return (v1 - v2).abs
11
- end
12
-
13
- def mri?
14
- RbConfig::CONFIG['ruby_install_name']=~ /^ruby$/i
15
- end
16
-
17
- def jruby?
18
- RbConfig::CONFIG['ruby_install_name']=~ /^jruby$/i
19
- end
20
-
21
- def rbx?
22
- RbConfig::CONFIG['ruby_install_name']=~ /^rbx$/i
23
- end
24
-
25
- def reset_gem_configuration
26
- Concurrent.instance_variable_set(:@configuration, Concurrent::Configuration.new)
27
- end
28
-
29
- extend self
30
- end
31
- end
32
-
33
- class RSpec::Core::ExampleGroup
34
- def self.with_full_reset
35
- before(:each) do
36
- reset_gem_configuration
37
- end
38
-
39
- after(:each) do
40
- Thread.list.each do |thread|
41
- thread.kill unless thread == Thread.current
42
- end
43
- end
44
- end
45
-
46
- include Concurrent::TestHelpers
47
- extend Concurrent::TestHelpers
48
- end
@@ -1,5 +0,0 @@
1
- RSpec::Matchers.define :be_less_than_or_equal_to do |expected|
2
- match do |actual|
3
- actual <= expected
4
- end
5
- end
File without changes