File tree Expand file tree Collapse file tree 3 files changed +1
-54
lines changed Expand file tree Collapse file tree 3 files changed +1
-54
lines changed Original file line number Diff line number Diff line change @@ -211,21 +211,6 @@ def release_write_lock
211
211
true
212
212
end
213
213
214
- # Returns a string representing *obj*. Includes the current reader and
215
- # writer counts.
216
- def to_s
217
- c = @counter . value
218
- s = if running_writer? ( c )
219
- "1 writer running, "
220
- elsif running_readers ( c ) > 0
221
- "#{ running_readers ( c ) } readers running, "
222
- else
223
- ""
224
- end
225
-
226
- "#<ReadWriteLock:#{ object_id . to_s ( 16 ) } #{ s } #{ waiting_writers ( c ) } writers waiting>"
227
- end
228
-
229
214
# Queries if the write lock is held by any thread.
230
215
#
231
216
# @return [Boolean] true if the write lock is held else false`
Original file line number Diff line number Diff line change @@ -489,43 +489,5 @@ module Concurrent
489
489
expect ( subject . release_write_lock ) . to be true
490
490
end
491
491
end
492
-
493
- context '#to_s' do
494
-
495
- it 'includes the running reader count' do
496
- subject . with_read_lock do
497
- expect ( subject . to_s ) . to match ( /1 readers running/ )
498
- end
499
- expect ( subject . to_s ) . to_not match ( /readers running/ )
500
- end
501
-
502
- it 'includes the running writer count' do
503
- subject . with_write_lock do
504
- expect ( subject . to_s ) . to match ( /1 writer running/ )
505
- end
506
- expect ( subject . to_s ) . to_not match ( /writer running/ )
507
- end
508
-
509
- it 'includes the waiting writer count' do
510
- start_latch = Concurrent ::CountDownLatch . new ( 1 )
511
- end_latch = Concurrent ::CountDownLatch . new ( 1 )
512
-
513
- thread = Thread . new do
514
- start_latch . wait ( 1 )
515
- subject . acquire_write_lock
516
- subject . release_write_lock
517
- end_latch . count_down
518
- end
519
-
520
- subject . with_write_lock do
521
- start_latch . count_down
522
- sleep ( 0.1 )
523
- expect ( subject . to_s ) . to match ( /1 writers waiting/ )
524
- end
525
- expect ( subject . to_s ) . to match ( /1 writers waiting/ )
526
- end_latch . wait ( 1 )
527
- expect ( subject . to_s ) . to match ( /0 writers waiting/ )
528
- end
529
- end
530
492
end
531
493
end
Original file line number Diff line number Diff line change 1
- Subproject commit 5aff4706f70d757c15830edd66d74759ff364eda
1
+ Subproject commit db7483b80f6efb7df9930f0031508d7e2eb6bad0
You can’t perform that action at this time.
0 commit comments