summaryrefslogtreecommitdiff
path: root/test/monitor/test_monitor.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-31 15:31:46 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-31 15:31:46 +0000
commit6f6dd30dbf3a1e77c643bb7e1391ed28e59f4dc7 (patch)
tree6af3ed96b10a908289a8c5ce4f5f14fa7fd89a89 /test/monitor/test_monitor.rb
parent06fb82343528ea1e479d10d97946862d8a3dff61 (diff)
Join threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/monitor/test_monitor.rb')
-rw-r--r--test/monitor/test_monitor.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/monitor/test_monitor.rb b/test/monitor/test_monitor.rb
index 8bd15ff55a..313ef23a95 100644
--- a/test/monitor/test_monitor.rb
+++ b/test/monitor/test_monitor.rb
@@ -86,7 +86,7 @@ class TestMonitor < Test::Unit::TestCase
def test_try_enter
queue1 = Queue.new
queue2 = Queue.new
- Thread.start {
+ th = Thread.start {
queue1.deq
@monitor.enter
queue2.enq(nil)
@@ -102,6 +102,7 @@ class TestMonitor < Test::Unit::TestCase
queue1.enq(nil)
queue2.deq
assert_equal(true, @monitor.try_enter)
+ th.join
end
def test_cond
@@ -109,7 +110,7 @@ class TestMonitor < Test::Unit::TestCase
a = "foo"
queue1 = Queue.new
- Thread.start do
+ th = Thread.start do
queue1.deq
@monitor.synchronize do
a = "bar"
@@ -123,13 +124,14 @@ class TestMonitor < Test::Unit::TestCase
assert_equal(true, result1)
assert_equal("bar", a)
end
+ th.join
end
def test_timedwait
cond = @monitor.new_cond
b = "foo"
queue2 = Queue.new
- Thread.start do
+ th = Thread.start do
queue2.deq
@monitor.synchronize do
b = "bar"
@@ -143,10 +145,11 @@ class TestMonitor < Test::Unit::TestCase
assert_equal(true, result2)
assert_equal("bar", b)
end
+ th.join
c = "foo"
queue3 = Queue.new
- Thread.start do
+ th = Thread.start do
queue3.deq
@monitor.synchronize do
c = "bar"
@@ -163,6 +166,7 @@ class TestMonitor < Test::Unit::TestCase
assert_equal(true, result4)
assert_equal("bar", c)
end
+ th.join
# d = "foo"
# cumber_thread = Thread.start {