From b44b01415f85574f59f1a67ea95a5504f3cac6b8 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Wed, 10 Feb 2010 14:47:52 +0100 Subject: [PATCH] Fix bug introduced in commit 413b747 While commit 413b747 fixed the issue of poll(2) returning too soon, it didn't work when the poll(2) call should've been blocking. This is now fixed and verified. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/locking.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/locking.py b/lib/locking.py index 3f30c06b9..9f5f7f588 100644 --- a/lib/locking.py +++ b/lib/locking.py @@ -141,12 +141,15 @@ class _SingleNotifyPipeConditionWaiter(object): while True: remaining_time = running_timeout.Remaining() - if remaining_time is not None and remaining_time < 0.0: - break + if remaining_time is not None: + if remaining_time < 0.0: + break - try: # Our calculation uses seconds, poll() wants milliseconds - result = self._poller.poll(1000 * remaining_time) + remaining_time *= 1000 + + try: + result = self._poller.poll(remaining_time) except EnvironmentError, err: if err.errno != errno.EINTR: raise -- GitLab