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
clinic
stringlib
README -rw-r--r-- 41 bytes
abstract.c -rw-r--r-- 70.7 KB
accu.c -rw-r--r-- 2.4 KB
boolobject.c -rw-r--r-- 7.1 KB
bytearrayobject.c -rw-r--r-- 72.0 KB
bytes_methods.c -rw-r--r-- 21.2 KB
bytesobject.c -rw-r--r-- 100.6 KB
call.c -rw-r--r-- 29.1 KB
capsule.c -rw-r--r-- 7.3 KB
cellobject.c -rw-r--r-- 5.6 KB
classobject.c -rw-r--r-- 18.0 KB
codeobject.c -rw-r--r-- 35.3 KB
complexobject.c -rw-r--r-- 31.0 KB
descrobject.c -rw-r--r-- 61.0 KB
dict-common.h -rw-r--r-- 2.2 KB
dictnotes.txt -rw-r--r-- 6.0 KB
dictobject.c -rw-r--r-- 148.9 KB
enumobject.c -rw-r--r-- 14.1 KB
exceptions.c -rw-r--r-- 88.2 KB
fileobject.c -rw-r--r-- 17.1 KB
floatobject.c -rw-r--r-- 71.2 KB
frameobject.c -rw-r--r-- 36.6 KB
funcobject.c -rw-r--r-- 31.0 KB
genericaliasobject.c -rw-r--r-- 16.7 KB
genobject.c -rw-r--r-- 69.7 KB
interpreteridobject.c -rw-r--r-- 8.6 KB
iterobject.c -rw-r--r-- 9.1 KB
listobject.c -rw-r--r-- 98.8 KB
listsort.txt -rw-r--r-- 35.3 KB
lnotab_notes.txt -rw-r--r-- 5.9 KB
longobject.c -rw-r--r-- 171.6 KB
memoryobject.c -rw-r--r-- 93.9 KB
methodobject.c -rw-r--r-- 17.0 KB
moduleobject.c -rw-r--r-- 25.2 KB
namespaceobject.c -rw-r--r-- 7.4 KB
object.c -rw-r--r-- 60.5 KB
obmalloc.c -rw-r--r-- 87.8 KB
odictobject.c -rw-r--r-- 73.5 KB
picklebufobject.c -rw-r--r-- 6.0 KB
rangeobject.c -rw-r--r-- 36.2 KB
setobject.c -rw-r--r-- 71.5 KB
sliceobject.c -rw-r--r-- 19.4 KB
structseq.c -rw-r--r-- 15.8 KB
tupleobject.c -rw-r--r-- 33.1 KB
typeobject.c -rw-r--r-- 252.9 KB
typeslots.inc -rw-r--r-- 4.0 KB
typeslots.py -rwxr-xr-x 1.2 KB
unicodectype.c -rw-r--r-- 7.5 KB
unicodeobject.c -rw-r--r-- 470.7 KB
unicodetype_db.h -rw-r--r-- 249.6 KB
unionobject.c -rw-r--r-- 12.2 KB
weakrefobject.c -rw-r--r-- 31.5 KB

README

back to top