summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-04-29 14:45:00 -0700
committerLance Stout <lancestout@gmail.com>2012-04-29 14:45:00 -0700
commit08716c35fd3c19921cdc87fdaaec7ddc56e88bb5 (patch)
tree6f22848f76149e5fc810249cc33d1b5701beccf2 /sleekxmpp
parentfd81bab906a44393cad7e5ee66d2c2207859d404 (diff)
downloadslixmpp-08716c35fd3c19921cdc87fdaaec7ddc56e88bb5.tar.gz
slixmpp-08716c35fd3c19921cdc87fdaaec7ddc56e88bb5.tar.bz2
slixmpp-08716c35fd3c19921cdc87fdaaec7ddc56e88bb5.tar.xz
slixmpp-08716c35fd3c19921cdc87fdaaec7ddc56e88bb5.zip
Set a timeout when waiting for threads.
If calling disconnect() from a non-threaded event handler, deadlock can happen as disconnect() is waiting for threads to close, but the event runner is blocked by a handler waiting for disconnect() to return. It is best to specify threaded=True for event handlers which may call disconnect().
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index d9e973ab..62083de8 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -1202,7 +1202,7 @@ class XMLStream(object):
if self.__thread_count != 0:
log.debug("Waiting for %s threads to exit." %
self.__thread_count)
- self.__thread_cond.wait()
+ self.__thread_cond.wait(4)
if self.__thread_count != 0:
raise Exception("Hanged threads: %s" % threading.enumerate())