use Queue for inter-thread synchronization.

* test/ruby/test_bignum.rb (test_interrupt_during_to_s): should not use
  "while" synchronization, but should use Queue.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2018-04-04 05:00:52 +00:00
Родитель 5ff72d0569
Коммит c563210532
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -615,14 +615,15 @@ class TestBignum < Test::Unit::TestCase
start_flag = false
end_flag = false
num = (65536 ** 65536)
q = Queue.new
thread = Thread.new do
start_flag = true
assert_raise(RuntimeError) {
q << true
num.to_s
end_flag = true
}
end
sleep 0.001 until start_flag
q.pop # sync
thread.raise
thread.join
time = Time.now - time