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

* test/ruby/test_thread.rb (test_status_and_stop_p): reduce the risk

of race condition.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2008-08-25 13:46:34 +00:00
parent cba52ec37c
commit bc3c178509
2 changed files with 14 additions and 6 deletions

View file

@ -299,19 +299,22 @@ class TestThread < Test::Unit::TestCase
d = Thread.new { sleep }
e = Thread.current
sleep 0.5
d.kill
assert_equal(nil, a.status)
assert(a.stop?)
assert_equal("sleep", b.status)
assert(b.stop?)
assert_equal(false, c.status)
assert_match(/^#<TestThread::Thread:.* dead>$/, c.inspect)
assert_equal("aborting", d.status)
assert_equal("run", e.status)
assert(a.stop?)
assert(b.stop?)
assert(c.stop?)
d.kill
assert_equal("aborting", d.status)
assert(!d.stop?)
assert_equal("run", e.status)
assert(!e.stop?)
ensure