From 837a0d89151514463295959944ea0b7828ae44c4 Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Fri, 4 Sep 2009 11:33:31 +0000 Subject: fixed the wait logic for session close git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@811350 13f79535-47bb-0310-9956-ffa450edef68 --- python/qpid/driver.py | 1 + python/qpid/messaging.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/qpid/driver.py b/python/qpid/driver.py index a759588572..fc6481bece 100644 --- a/python/qpid/driver.py +++ b/python/qpid/driver.py @@ -191,6 +191,7 @@ class Driver: if ssn.closing: _ssn.close() del self._attachments[ssn] + ssn.closed = True def _exchange_query(self, ssn, address): # XXX: auto sync hack is to avoid deadlock on future diff --git a/python/qpid/messaging.py b/python/qpid/messaging.py index 2bf822b4c8..d755aa5054 100644 --- a/python/qpid/messaging.py +++ b/python/qpid/messaging.py @@ -286,6 +286,7 @@ class Session: self.closed = False self._lock = connection._lock + self.running = True self.thread = Thread(target = self.run) self.thread.setDaemon(True) self.thread.start() @@ -460,6 +461,7 @@ class Session: @synchronized def run(self): + self.running = True try: while True: msg = self._get(self._pred) @@ -470,7 +472,7 @@ class Session: if self._peek(self._pred) is None: self.connection._waiter.notifyAll() finally: - self.closed = True + self.running = False self.connection._waiter.notifyAll() @synchronized @@ -483,7 +485,7 @@ class Session: self.closing = True self._wakeup() - self._ewait(lambda: self.closed) + self._ewait(lambda: self.closed and not self.running) while self.thread.isAlive(): self.thread.join(3) self.thread = None -- cgit v1.2.1