зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
665333e314
Коммит
b7ff46b7a4
|
@ -240,7 +240,10 @@ class IMAPTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
th.raise(Interrupt)
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче