mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
5ff72d0569
commit
c563210532
1 changed files with 3 additions and 2 deletions
|
@ -615,14 +615,15 @@ class TestBignum < Test::Unit::TestCase
|
||||||
start_flag = false
|
start_flag = false
|
||||||
end_flag = false
|
end_flag = false
|
||||||
num = (65536 ** 65536)
|
num = (65536 ** 65536)
|
||||||
|
q = Queue.new
|
||||||
thread = Thread.new do
|
thread = Thread.new do
|
||||||
start_flag = true
|
|
||||||
assert_raise(RuntimeError) {
|
assert_raise(RuntimeError) {
|
||||||
|
q << true
|
||||||
num.to_s
|
num.to_s
|
||||||
end_flag = true
|
end_flag = true
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
sleep 0.001 until start_flag
|
q.pop # sync
|
||||||
thread.raise
|
thread.raise
|
||||||
thread.join
|
thread.join
|
||||||
time = Time.now - time
|
time = Time.now - time
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue