summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/thread/test_cv.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/thread/test_cv.rb b/test/thread/test_cv.rb
index a093f373b18..b010b1fe5cf 100644
--- a/test/thread/test_cv.rb
+++ b/test/thread/test_cv.rb
@@ -228,8 +228,14 @@ INPUT
end
thrs.each { 3.times { Thread.pass } }
pid = fork do
- mutex.synchronize { condvar.broadcast }
- exit!(0)
+ th = Thread.new do
+ mutex.synchronize { condvar.wait(mutex) }
+ :ok
+ end
+ until th.join(0.01)
+ mutex.synchronize { condvar.broadcast }
+ end
+ exit!(th.value == :ok ? 0 : 1)
end
_, s = Process.waitpid2(pid)
assert_predicate s, :success?, 'no segfault [ruby-core:86316] [Bug #14634]'