summaryrefslogtreecommitdiff
path: root/python/qpid/messaging.py
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2009-09-04 11:33:31 +0000
committerRafael H. Schloming <rhs@apache.org>2009-09-04 11:33:31 +0000
commit837a0d89151514463295959944ea0b7828ae44c4 (patch)
tree9d7488073fc60237009b3482ffaee4a2cca40cda /python/qpid/messaging.py
parent1f167dbd032708567ec7c1fe639258db39e27cd7 (diff)
downloadqpid-python-837a0d89151514463295959944ea0b7828ae44c4.tar.gz
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
Diffstat (limited to 'python/qpid/messaging.py')
-rw-r--r--python/qpid/messaging.py6
1 files changed, 4 insertions, 2 deletions
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