From fab171e541f7b7373efe386ae956d7a44ce4e330 Mon Sep 17 00:00:00 2001 From: eregon Date: Mon, 5 Oct 2015 11:44:30 +0000 Subject: [PATCH] * test/ruby/test_thread.rb: fix potential race condition. The thread could have a "sleep" status because it tries to acquire the mutex, but does not have it yet. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ test/ruby/test_thread.rb | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5586420d45..1985c52ea2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Oct 5 20:39:32 2015 Benoit Daloze + + * test/ruby/test_thread.rb: fix potential race condition. + The thread could have a "sleep" status because it tries + to acquire the mutex, but does not have it yet. + Mon Oct 5 15:39:30 2015 Zachary Scott * numeric.c: [DOC] Overview for Numeric class by Joe Corcoran diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index eaf65ae86d..e60da4f120 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -914,9 +914,8 @@ q.pop sleep } - Thread.pass until th.status == "sleep" - # acquired another thread. - assert_equal(mutex.locked?, true) + # acquired by another thread. + Thread.pass until mutex.locked? assert_equal(mutex.owned?, false) ensure th.kill if th