From 52833097fb1737316c76822bf7e6dda31dec3433 Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Fri, 23 May 2008 20:36:10 +0000 Subject: QPID-1064: only set the listeners to None *after* the thread has stopped git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@659650 13f79535-47bb-0310-9956-ffa450edef68 --- python/qpid/queue.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'python/qpid/queue.py') diff --git a/python/qpid/queue.py b/python/qpid/queue.py index 830ea6060d..c9f4d1d1d0 100644 --- a/python/qpid/queue.py +++ b/python/qpid/queue.py @@ -60,19 +60,19 @@ class Queue(BaseQueue): if listener is None and exc_listener is not None: raise ValueError("cannot set exception listener without setting listener") - self.listener = listener - self.exc_listener = exc_listener - if listener is None: if self.thread is not None: self.put(Queue.STOP) self.thread.join() self.thread = None - else: - if self.thread is None: - self.thread = Thread(target = self.run) - self.thread.setDaemon(True) - self.thread.start() + + self.listener = listener + self.exc_listener = exc_listener + + if listener is not None and self.thread is None: + self.thread = Thread(target = self.run) + self.thread.setDaemon(True) + self.thread.start() def run(self): while True: -- cgit v1.2.1