Redis: Close channel poller thread on finalization

This commit is contained in:
Ask Solem 2010-11-11 11:23:46 +01:00
parent 9602fae65b
commit 61a40f8659
1 changed files with 3 additions and 0 deletions

View File

@ -14,6 +14,7 @@ from Queue import Empty, Queue as _Queue
from anyjson import serialize, deserialize from anyjson import serialize, deserialize
from kombu.transport import virtual from kombu.transport import virtual
from kombu.utils.finalize import Finalize
DEFAULT_PORT = 6379 DEFAULT_PORT = 6379
DEFAULT_DB = 0 DEFAULT_DB = 0
@ -40,6 +41,8 @@ class ChannelPoller(Thread):
self.poll_request = Condition(self.mutex) self.poll_request = Condition(self.mutex)
self.shutdown = Event() self.shutdown = Event()
self.stopped = Event() self.stopped = Event()
self._on_collect = Finalize(self, self.close)
Thread.__init__(self) Thread.__init__(self)
self.setDaemon(False) self.setDaemon(False)
self.started = False self.started = False