Staging
v0.5.1
https://github.com/python/cpython
Revision c41559021213cfc9dc62a83fc63306b3bdc3e64b authored by MARUYAMA Norihiro on 01 November 2020, 23:51:04 UTC, committed by GitHub on 01 November 2020, 23:51:04 UTC
* bpo-37193: remove the thread which finished process request from threads list

* rename variable t to thread.

* don't remove thread from list if it is daemon.

* use lock to protect self._threads.

* use finally block in case of exception from shutdown_request().

* check "not thread.daemon" before lock to avoid holding the lock if it's unnecessary.

* fix the place of _threads_lock.

* separate code to remove a current thread into a function.

* check ValueError when removing thread.

* fix wrong code which all instance shared same lock.

* Extract thread management into a _Threads class to encapsulate atomic operations and separate concerns.

* Replace multiple references of 'block_on_close' with one, avoiding the possibility that 'block_on_close' could change during the course of processing requests. Now, there's exactly one _threads object with behavior fixed for the duration.

* Add docstrings to private classes.

* Add test to ensure that a ThreadingTCPServer can be closed without serving any requests.

* Use _NoThreads as the default value. Fixes AttributeError when server is closed without serving any requests.

* Add blurb

* Add test capturing failure.

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
1 parent e662c39
History
Tip revision: c41559021213cfc9dc62a83fc63306b3bdc3e64b authored by MARUYAMA Norihiro on 01 November 2020, 23:51:04 UTC
bpo-37193: remove thread objects which finished process its request (GH-13893)
Tip revision: c415590
File Mode Size
.azure-pipelines
.github
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Programs
Python
Tools
m4
.gitattributes -rw-r--r-- 1.9 KB
.gitignore -rw-r--r-- 1.8 KB
.travis.yml -rw-r--r-- 8.4 KB
CODE_OF_CONDUCT.md -rw-r--r-- 630 bytes
LICENSE -rw-r--r-- 13.6 KB
Makefile.pre.in -rw-r--r-- 67.8 KB
README.rst -rw-r--r-- 10.0 KB
aclocal.m4 -rw-r--r-- 15.2 KB
config.guess -rwxr-xr-x 43.1 KB
config.sub -rwxr-xr-x 35.4 KB
configure -rwxr-xr-x 501.3 KB
configure.ac -rw-r--r-- 169.3 KB
install-sh -rwxr-xr-x 15.0 KB
netlify.toml -rw-r--r-- 82 bytes
pyconfig.h.in -rw-r--r-- 44.6 KB
setup.py -rw-r--r-- 109.0 KB

README.rst

back to top