In _Threads, reap on append.
This commit is contained in:
parent
848ac2e29e
commit
ec8e6895a3
|
@ -633,6 +633,7 @@ class _Threads(list):
|
|||
Joinable list of all non-daemon threads.
|
||||
"""
|
||||
def append(self, thread):
|
||||
self.reap()
|
||||
if thread.daemon:
|
||||
return
|
||||
super().append(thread)
|
||||
|
@ -659,9 +660,6 @@ class _NoThreads:
|
|||
def join(self):
|
||||
pass
|
||||
|
||||
def reap(self):
|
||||
pass
|
||||
|
||||
|
||||
class ThreadingMixIn:
|
||||
"""Mix-in class to handle each request in a new thread."""
|
||||
|
@ -692,7 +690,6 @@ class ThreadingMixIn:
|
|||
"""Start a new thread to process the request."""
|
||||
if self.block_on_close:
|
||||
vars(self).setdefault('_threads', _Threads())
|
||||
self._threads.reap()
|
||||
t = threading.Thread(target = self.process_request_thread,
|
||||
args = (request, client_address))
|
||||
t.daemon = self.daemon_threads
|
||||
|
|
Loading…
Reference in New Issue