1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fixed ClosedQueueError by a timing issue

This commit is contained in:
Nobuyoshi Nakada 2019-06-30 09:44:15 +09:00
parent 44eca1b22f
commit 8fe3590864
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -331,11 +331,14 @@ class TestThreadQueue < Test::Unit::TestCase
def test_sized_queue_one_closed_interrupt
q = SizedQueue.new 1
q << :one
t1 = Thread.new { q << :two }
t1 = Thread.new {
Thread.current.report_on_exception = false
q << :two
}
sleep 0.01 until t1.stop?
q.close
assert_raise(ClosedQueueError) {t1.join}
t1.kill.join
assert_equal 1, q.size
assert_equal :one, q.pop
assert q.empty?, "queue not empty"