Skip to content

Commit 445146a

Browse files
committed
Remove remaining non-deterministic bit
1 parent 92073c1 commit 445146a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

spec/concurrent/executor/thread_pool_executor_shared.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,22 @@
255255
specify 'a #post task is never executed when the queue is at capacity' do
256256
lock = Mutex.new
257257
lock.lock
258+
259+
latch = Concurrent::CountDownLatch.new(max_threads)
260+
258261
initial_executed = Concurrent::AtomicFixnum.new(0)
259262
subsequent_executed = Concurrent::AtomicFixnum.new(0)
260263

261264
# Fill up all the threads (with a task that won't run until
262265
# lock.unlock is called)
263266
max_threads.times do
264-
subject.post{ lock.lock; initial_executed.increment; lock.unlock }
267+
subject.post{ latch.count_down; lock.lock; initial_executed.increment; lock.unlock }
265268
end
266269

270+
# Wait for all those tasks to be taken off the queue onto a
271+
# worker thread and start executing
272+
latch.wait
273+
267274
# Fill up the queue (with a task that won't run until
268275
# lock.unlock is called)
269276
max_queue.times do

0 commit comments

Comments
 (0)