Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion magicbus/plugins/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
except AttributeError:
max_files = 1024

if hasattr(threading.currentThread(), 'is_alive'):
is_alive = lambda t: t.is_alive()
else:
is_alive = lambda t: t.isAlive()

from magicbus import plugins


Expand Down Expand Up @@ -44,8 +49,12 @@ def EXIT(self):
# the main thread to call atexit handlers.
# See https://github.com/cherrypy/cherrypy/issues/751.
self.bus.log('Waiting for child threads to terminate...')
curthread = threading.currentThread()
for t in threading.enumerate():
if t == threading.current_thread() or not t.is_alive():
if t is curthread:
continue

if not is_alive(t):
continue

# Note that any dummy (external) threads are always daemonic.
Expand Down
Loading