@@ -142,8 +142,8 @@ module Concurrent
142
142
end
143
143
144
144
it 'raises an exception if maximum lock limit is exceeded' do
145
- counter = Concurrent ::AtomicReference . new ( ReadWriteLock ::MAX_READERS )
146
- allow ( Concurrent ::AtomicReference ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
145
+ counter = Concurrent ::AtomicFixnum . new ( ReadWriteLock ::MAX_READERS )
146
+ allow ( Concurrent ::AtomicFixnum ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
147
147
expect {
148
148
subject . with_read_lock { nil }
149
149
} . to raise_error ( Concurrent ::ResourceLimitError )
@@ -183,8 +183,8 @@ module Concurrent
183
183
end
184
184
185
185
it 'raises an exception if maximum lock limit is exceeded' do
186
- counter = Concurrent ::AtomicReference . new ( ReadWriteLock ::MAX_WRITERS )
187
- allow ( Concurrent ::AtomicReference ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
186
+ counter = Concurrent ::AtomicFixnum . new ( ReadWriteLock ::MAX_WRITERS )
187
+ allow ( Concurrent ::AtomicFixnum ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
188
188
expect {
189
189
subject . with_write_lock { nil }
190
190
} . to raise_error ( Concurrent ::ResourceLimitError )
@@ -202,8 +202,8 @@ module Concurrent
202
202
context '#acquire_read_lock' do
203
203
204
204
it 'increments the lock count' do
205
- counter = Concurrent ::AtomicReference . new ( 0 )
206
- allow ( Concurrent ::AtomicReference ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
205
+ counter = Concurrent ::AtomicFixnum . new ( 0 )
206
+ allow ( Concurrent ::AtomicFixnum ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
207
207
subject . acquire_read_lock
208
208
expect ( counter . value ) . to eq 1
209
209
end
@@ -243,8 +243,8 @@ module Concurrent
243
243
end
244
244
245
245
it 'does not wait for any running readers' do
246
- counter = Concurrent ::AtomicReference . new ( 0 )
247
- allow ( Concurrent ::AtomicReference ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
246
+ counter = Concurrent ::AtomicFixnum . new ( 0 )
247
+ allow ( Concurrent ::AtomicFixnum ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
248
248
249
249
latch_1 = Concurrent ::CountDownLatch . new ( 1 )
250
250
latch_2 = Concurrent ::CountDownLatch . new ( 1 )
@@ -282,8 +282,8 @@ module Concurrent
282
282
end
283
283
284
284
it 'raises an exception if maximum lock limit is exceeded' do
285
- counter = Concurrent ::AtomicReference . new ( ReadWriteLock ::MAX_WRITERS )
286
- allow ( Concurrent ::AtomicReference ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
285
+ counter = Concurrent ::AtomicFixnum . new ( ReadWriteLock ::MAX_WRITERS )
286
+ allow ( Concurrent ::AtomicFixnum ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
287
287
expect {
288
288
subject . acquire_write_lock { nil }
289
289
} . to raise_error ( Concurrent ::ResourceLimitError )
@@ -297,8 +297,8 @@ module Concurrent
297
297
context '#release_read_lock' do
298
298
299
299
it 'decrements the counter' do
300
- counter = Concurrent ::AtomicReference . new ( 0 )
301
- allow ( Concurrent ::AtomicReference ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
300
+ counter = Concurrent ::AtomicFixnum . new ( 0 )
301
+ allow ( Concurrent ::AtomicFixnum ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
302
302
subject . acquire_read_lock
303
303
expect ( counter . value ) . to eq 1
304
304
subject . release_read_lock
@@ -340,8 +340,8 @@ module Concurrent
340
340
context '#acquire_write_lock' do
341
341
342
342
it 'increments the lock count' do
343
- counter = Concurrent ::AtomicReference . new ( 0 )
344
- allow ( Concurrent ::AtomicReference ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
343
+ counter = Concurrent ::AtomicFixnum . new ( 0 )
344
+ allow ( Concurrent ::AtomicFixnum ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
345
345
subject . acquire_write_lock
346
346
expect ( counter . value ) . to be > 1
347
347
end
@@ -415,8 +415,8 @@ module Concurrent
415
415
end
416
416
417
417
it 'raises an exception if maximum lock limit is exceeded' do
418
- counter = Concurrent ::AtomicReference . new ( ReadWriteLock ::MAX_WRITERS )
419
- allow ( Concurrent ::AtomicReference ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
418
+ counter = Concurrent ::AtomicFixnum . new ( ReadWriteLock ::MAX_WRITERS )
419
+ allow ( Concurrent ::AtomicFixnum ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
420
420
expect {
421
421
subject . acquire_write_lock { nil }
422
422
} . to raise_error ( Concurrent ::ResourceLimitError )
@@ -430,8 +430,8 @@ module Concurrent
430
430
context '#release_write_lock' do
431
431
432
432
it 'decrements the counter' do
433
- counter = Concurrent ::AtomicReference . new ( 0 )
434
- allow ( Concurrent ::AtomicReference ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
433
+ counter = Concurrent ::AtomicFixnum . new ( 0 )
434
+ allow ( Concurrent ::AtomicFixnum ) . to receive ( :new ) . with ( anything ) . and_return ( counter )
435
435
subject . acquire_write_lock
436
436
expect ( counter . value ) . to be > 1
437
437
subject . release_write_lock
0 commit comments