* test/net/imap/test_imap.rb (test_exception_during_idle): use timeout.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
332e8fe51f
commit
237c2211e6
@ -215,16 +215,25 @@ class IMAPTest < Test::Unit::TestCase
|
|||||||
begin
|
begin
|
||||||
th = Thread.current
|
th = Thread.current
|
||||||
m = Monitor.new
|
m = Monitor.new
|
||||||
|
in_idle = false
|
||||||
|
exception_raised = false
|
||||||
c = m.new_cond
|
c = m.new_cond
|
||||||
Thread.start do
|
Thread.start do
|
||||||
m.synchronize do
|
m.synchronize do
|
||||||
c.wait
|
until in_idle
|
||||||
|
c.wait(0.1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
th.raise(Interrupt)
|
th.raise(Interrupt)
|
||||||
|
exception_raised = true
|
||||||
end
|
end
|
||||||
imap.idle do |res|
|
imap.idle do |res|
|
||||||
m.synchronize do
|
m.synchronize do
|
||||||
|
in_idle = true
|
||||||
c.signal
|
c.signal
|
||||||
|
until exception_raised
|
||||||
|
c.wait(0.1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user