diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-13 02:05:40 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-13 02:05:40 +0000 |
commit | 2c39852e3f567c509b13aae40c72acb37232985b (patch) | |
tree | 23a1b0af3bfef5e22cc003b4299e19fabc6a2144 /test/net | |
parent | 079b5cc0bb8ca6fa3d3955cefc6f07737070df7f (diff) | |
download | ruby-2c39852e3f567c509b13aae40c72acb37232985b.tar.gz |
test/net/imap: fix race condition in test_exception_during_idle
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net')
-rw-r--r-- | test/net/imap/test_imap.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb index 3224da65a1..9266cbdf81 100644 --- a/test/net/imap/test_imap.rb +++ b/test/net/imap/test_imap.rb @@ -240,7 +240,10 @@ class IMAPTest < Test::Unit::TestCase end end th.raise(Interrupt) - exception_raised = true + m.synchronize do + exception_raised = true + c.signal + end end imap.idle do |res| m.synchronize do @@ -417,7 +420,7 @@ class IMAPTest < Test::Unit::TestCase begin m = Monitor.new in_idle = false - exception_raised = false + closed = false c = m.new_cond threads << Thread.start do m.synchronize do @@ -426,14 +429,17 @@ class IMAPTest < Test::Unit::TestCase end end sock.close - exception_raised = true + m.synchronize do + closed = true + c.signal + end end assert_raise(Net::IMAP::Error) do imap.idle do |res| m.synchronize do in_idle = true c.signal - until exception_raised + until closed c.wait(0.1) end end |