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:
parent
0a831b3cab
commit
beaaf77a1a
@ -67,7 +67,6 @@ if bytes != str:
|
|||||||
else:
|
else:
|
||||||
import Queue as queue
|
import Queue as queue
|
||||||
string_types = basestring
|
string_types = basestring
|
||||||
threading.TIMEOUT_MAX = 9223372036854.0
|
|
||||||
|
|
||||||
select_module = select
|
select_module = select
|
||||||
|
|
||||||
@ -192,7 +191,7 @@ class Request(object):
|
|||||||
def get_response(self, exc_fmt=None):
|
def get_response(self, exc_fmt=None):
|
||||||
self.callback = None
|
self.callback = None
|
||||||
if __debug__: self.parent._log(3, '%s:%s.ready.wait' % (self.name, self.tag))
|
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:
|
if self.aborted is not None:
|
||||||
typ, val = self.aborted
|
typ, val = self.aborted
|
||||||
@ -1400,7 +1399,7 @@ class IMAP4(object):
|
|||||||
self.commands_lock.release()
|
self.commands_lock.release()
|
||||||
if need_event:
|
if need_event:
|
||||||
if __debug__: self._log(3, 'sync command %s waiting for empty commands Q' % name)
|
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 __debug__: self._log(3, 'sync command %s proceeding' % name)
|
||||||
|
|
||||||
if self.state not in Commands[name][CMD_VAL_STATES]:
|
if self.state not in Commands[name][CMD_VAL_STATES]:
|
||||||
|
Loading…
Reference in New Issue
Block a user