From 6013bb1247d197fb6af4971b1bce5a6ef119ff2c Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 11 May 2010 14:43:03 +0200 Subject: [PATCH] fix a race condition in responses handling (some responses could be lost). --- weboob/bcall.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weboob/bcall.py b/weboob/bcall.py index 564f130f..da6c9362 100644 --- a/weboob/bcall.py +++ b/weboob/bcall.py @@ -131,7 +131,7 @@ class BackendsCall(object): def _callback_thread_run(self, callback, errback): responses = [] - while not self.finish_event.isSet(): + while not self.finish_event.isSet() or self.response_event.isSet(): self.response_event.wait() with self.mutex: responses = self.responses @@ -171,7 +171,7 @@ class BackendsCall(object): def __iter__(self): # Don't know how to factorize with _callback_thread_run responses = [] - while not self.finish_event.isSet(): + while not self.finish_event.isSet() or self.response_event.isSet(): self.response_event.wait() with self.mutex: responses = self.responses