* 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:
parent
cba52ec37c
commit
bc3c178509
@ -1,3 +1,8 @@
|
|||||||
|
Mon Aug 25 22:46:01 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* test/ruby/test_thread.rb (test_status_and_stop_p): reduce the risk
|
||||||
|
of race condition.
|
||||||
|
|
||||||
Mon Aug 25 22:39:57 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
Mon Aug 25 22:39:57 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
* lib/irb/extend-command.rb (def_extend_command): check number of
|
* lib/irb/extend-command.rb (def_extend_command): check number of
|
||||||
|
@ -299,19 +299,22 @@ class TestThread < Test::Unit::TestCase
|
|||||||
d = Thread.new { sleep }
|
d = Thread.new { sleep }
|
||||||
e = Thread.current
|
e = Thread.current
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
d.kill
|
|
||||||
|
|
||||||
assert_equal(nil, a.status)
|
assert_equal(nil, a.status)
|
||||||
|
assert(a.stop?)
|
||||||
|
|
||||||
assert_equal("sleep", b.status)
|
assert_equal("sleep", b.status)
|
||||||
|
assert(b.stop?)
|
||||||
|
|
||||||
assert_equal(false, c.status)
|
assert_equal(false, c.status)
|
||||||
assert_match(/^#<TestThread::Thread:.* dead>$/, c.inspect)
|
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?)
|
assert(c.stop?)
|
||||||
|
|
||||||
|
d.kill
|
||||||
|
assert_equal("aborting", d.status)
|
||||||
assert(!d.stop?)
|
assert(!d.stop?)
|
||||||
|
|
||||||
|
assert_equal("run", e.status)
|
||||||
assert(!e.stop?)
|
assert(!e.stop?)
|
||||||
|
|
||||||
ensure
|
ensure
|
||||||
|
Loading…
x
Reference in New Issue
Block a user