summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 13:46:34 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 13:46:34 +0000
commitbc3c17850915d840f136189bd3ace5d5369dde2d (patch)
tree5b47aaef600b4e141ba75d91b4a967c01c1228cc
parentcba52ec37cbe5be168f00ca9568e68fb1ed4f984 (diff)
* 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
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_thread.rb15
2 files changed, 14 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 1a04ef0c45..1e58a588ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* lib/irb/extend-command.rb (def_extend_command): check number of
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index 043917f2ec..cd99cdc401 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -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