Fix AssertionError on shutdown
Fix
* Drop `isAlive()` check since `threading.enumerate()` always iterates alive threads
* Simplify check for daemon mode
@@ -342,16 +342,10 @@ class Bus(object):
# that another thread executes cherrypy.engine.exit()
if (
t != threading.currentThread() and
- t.isAlive() and
- not isinstance(t, threading._MainThread)
- ):
+ not isinstance(t, threading._MainThread) and
# Note that any dummy (external) threads are always daemonic.
- if hasattr(threading.Thread, 'daemon'):
- # Python 2.6+
- d = t.daemon
- else:
- d = t.isDaemon()
- if not d:
+ not t.daemon
+ ):
self.log('Waiting for thread %s.' % t.getName())
t.join()
