Skip to content

Commit ec8e689

Browse files
committed
In _Threads, reap on append.
1 parent 848ac2e commit ec8e689

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Lib/socketserver.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ class _Threads(list):
633633
Joinable list of all non-daemon threads.
634634
"""
635635
def append(self, thread):
636+
self.reap()
636637
if thread.daemon:
637638
return
638639
super().append(thread)
@@ -659,9 +660,6 @@ def append(self, thread):
659660
def join(self):
660661
pass
661662

662-
def reap(self):
663-
pass
664-
665663

666664
class ThreadingMixIn:
667665
"""Mix-in class to handle each request in a new thread."""
@@ -692,7 +690,6 @@ def process_request(self, request, client_address):
692690
"""Start a new thread to process the request."""
693691
if self.block_on_close:
694692
vars(self).setdefault('_threads', _Threads())
695-
self._threads.reap()
696693
t = threading.Thread(target = self.process_request_thread,
697694
args = (request, client_address))
698695
t.daemon = self.daemon_threads

0 commit comments

Comments
 (0)