@@ -45,14 +45,14 @@ module Concurrent
4545 end
4646
4747 it 'returns zero while running' do
48- 10 . times { subject . post { nil } }
48+ 10 . times { subject . post { nil } }
4949 subject . post { latch . count_down }
5050 latch . wait ( 0.1 )
5151 expect ( subject . min_length ) . to eq 0
5252 end
5353
5454 it 'returns zero once shutdown' do
55- 10 . times { subject . post { nil } }
55+ 10 . times { subject . post { nil } }
5656 subject . post { latch . count_down }
5757 latch . wait ( 0.1 )
5858 subject . shutdown
@@ -68,14 +68,14 @@ module Concurrent
6868 end
6969
7070 it 'returns :max_length while running' do
71- 10 . times { subject . post { nil } }
71+ 10 . times { subject . post { nil } }
7272 subject . post { latch . count_down }
7373 latch . wait ( 0.1 )
7474 expect ( subject . max_length ) . to eq described_class ::DEFAULT_MAX_POOL_SIZE
7575 end
7676
7777 it 'returns :max_length once shutdown' do
78- 10 . times { subject . post { nil } }
78+ 10 . times { subject . post { nil } }
7979 subject . post { latch . count_down }
8080 latch . wait ( 0.1 )
8181 subject . shutdown
@@ -91,14 +91,14 @@ module Concurrent
9191 end
9292
9393 it 'returns a non-zero number once tasks have been received' do
94- 10 . times { subject . post { sleep ( 0.1 ) } }
94+ 10 . times { subject . post { sleep ( 0.1 ) } }
9595 subject . post { latch . count_down }
9696 latch . wait ( 0.1 )
9797 expect ( subject . largest_length ) . to be > 0
9898 end
9999
100100 it 'returns a non-zero number after shutdown if tasks have been received' do
101- 10 . times { subject . post { sleep ( 0.1 ) } }
101+ 10 . times { subject . post { sleep ( 0.1 ) } }
102102 subject . post { latch . count_down }
103103 latch . wait ( 0.1 )
104104 subject . shutdown
@@ -109,7 +109,7 @@ module Concurrent
109109
110110 context '#idletime' do
111111
112- subject { described_class . new ( idletime : 42 ) }
112+ subject { described_class . new ( idletime : 42 ) }
113113
114114 it 'returns the thread idletime' do
115115 expect ( subject . idletime ) . to eq 42
@@ -123,7 +123,7 @@ module Concurrent
123123 context '#initialize' do
124124
125125 it 'sets :fallback_policy correctly' do
126- clazz = java . util . concurrent . ThreadPoolExecutor ::DiscardPolicy
126+ clazz = java . util . concurrent . ThreadPoolExecutor ::DiscardPolicy
127127 policy = clazz . new
128128 expect ( clazz ) . to receive ( :new ) . at_least ( :once ) . with ( any_args ) . and_return ( policy )
129129
@@ -206,21 +206,17 @@ module Concurrent
206206 # https://github.com/ruby-concurrency/concurrent-ruby/issues/817
207207 # https://github.com/ruby-concurrency/concurrent-ruby/issues/839
208208 it 'does not stop shutdown ' do
209- Timeout :: timeout ( 10 ) do
210- `
211- bundle exec ruby -e "
212- require 'concurrent- ruby'
213- # the test relies on replicating that Minitest messed up the AtExit handling
214- Concurrent.disable_at_exit_handlers!
215- pool = Concurrent::CachedThreadPool.new
216- pool.post do
217- sleep # sleep indefinitely
209+ Timeout . timeout ( 10 ) do
210+ begin
211+ test_file = File . join File . dirname ( __FILE__ ) , 'pool_quits.rb'
212+ pid = spawn RbConfig . ruby , test_file
213+ Process . waitpid pid
214+ expect ( $? . success? ) . to eq true
215+ rescue Timeout :: Error => e
216+ Process . kill :KILL , pid
217+ raise e
218218 end
219- # the process main thread should quit out which should kill the daemon CachedThreadPool
220- "
221- `
222219 end
223- expect ( $?. success? ) . to eq true
224220 end
225221
226222 end
0 commit comments