diff options
author | Lance Stout <lancestout@gmail.com> | 2012-04-20 15:19:56 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-04-20 15:21:31 -0700 |
commit | 8ee30179eae3b6697629aad50ca31df9daa5ef6e (patch) | |
tree | 7024d566a475a9202734eba9d8156b18f938ad8a /sleekxmpp/xmlstream/xmlstream.py | |
parent | cb2469322b68cfc0c3761fdcb0cd6acafa0a3647 (diff) | |
download | slixmpp-8ee30179eae3b6697629aad50ca31df9daa5ef6e.tar.gz slixmpp-8ee30179eae3b6697629aad50ca31df9daa5ef6e.tar.bz2 slixmpp-8ee30179eae3b6697629aad50ca31df9daa5ef6e.tar.xz slixmpp-8ee30179eae3b6697629aad50ca31df9daa5ef6e.zip |
Add _use_daemons flag to XMLStream to run all threads in daemon mode.
This WILL make the Python interpreter produce exceptions on shutdown.
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 891f275a..c5c8581b 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -282,6 +282,7 @@ class XMLStream(object): self.__event_handlers = {} self.__event_handlers_lock = threading.Lock() self.__filters = {'in': [], 'out': [], 'out_sync': []} + self._use_daemons = False self._id = 0 self._id_lock = threading.Lock() @@ -1206,10 +1207,11 @@ class XMLStream(object): else: threaded = kwargs.get('threaded', True) - self.scheduler.process(threaded=True) + self.scheduler.process(threaded=True, daemon=self._use_daemons) def start_thread(name, target): self.__thread[name] = threading.Thread(name=name, target=target) + self.__thread[name].daemon = self._use_daemons self.__thread[name].start() for t in range(0, HANDLER_THREADS): @@ -1451,6 +1453,7 @@ class XMLStream(object): name="Event_%s" % str(func), target=self._threaded_event_wrapper, args=(func, args)) + x.daemon = self._use_daemons x.start() else: func(*args) |