Do not use TIMEOUT_MAX for Condition.wait()

On some architectures, using threading.TIMEOUT_MAX for the timeout
parameter can overflow causing Condition.wait() to return immediately.
Instead of relying on TIMEOUT_MAX, remove it and wait forever.

Signed-off-by: Ilias Tsitsimpis <iliastsi@debian.org>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Ilias Tsitsimpis 2018-08-09 00:01:27 +03:00 committed by Nicolas Sebrecht
parent 0a831b3cab
commit beaaf77a1a

View File

@ -67,7 +67,6 @@ if bytes != str:
else:
import Queue as queue
string_types = basestring
threading.TIMEOUT_MAX = 9223372036854.0
select_module = select
@ -192,7 +191,7 @@ class Request(object):
def get_response(self, exc_fmt=None):
self.callback = None
if __debug__: self.parent._log(3, '%s:%s.ready.wait' % (self.name, self.tag))
self.ready.wait(threading.TIMEOUT_MAX)
self.ready.wait()
if self.aborted is not None:
typ, val = self.aborted
@ -1400,7 +1399,7 @@ class IMAP4(object):
self.commands_lock.release()
if need_event:
if __debug__: self._log(3, 'sync command %s waiting for empty commands Q' % name)
self.state_change_free.wait(threading.TIMEOUT_MAX)
self.state_change_free.wait()
if __debug__: self._log(3, 'sync command %s proceeding' % name)
if self.state not in Commands[name][CMD_VAL_STATES]: