diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-05 11:44:30 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-05 11:44:30 +0000 |
commit | ad3b5a7ffe37a989d19ac902c46ecd81c66b0d7b (patch) | |
tree | 4c78cab8639d6cea73b318ebb4466860b2158017 /test/ruby/test_thread.rb | |
parent | 45078bb6ddb0387dabcaeb7e66f0e50eb085b9a5 (diff) | |
download | ruby-ad3b5a7ffe37a989d19ac902c46ecd81c66b0d7b.tar.gz |
* 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
Diffstat (limited to 'test/ruby/test_thread.rb')
-rw-r--r-- | test/ruby/test_thread.rb | 5 |
1 files changed, 2 insertions, 3 deletions
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 |