mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #1856: Avoid crashes and lockups when daemon threads run while the
interpreter is shutting down; instead, these threads are now killed when they try to take the GIL.
This commit is contained in:
commit
fc20b0c65c
6 changed files with 69 additions and 7 deletions
|
@ -440,6 +440,12 @@ PyEval_RestoreThread(PyThreadState *tstate)
|
|||
if (gil_created()) {
|
||||
int err = errno;
|
||||
take_gil(tstate);
|
||||
/* _Py_Finalizing is protected by the GIL */
|
||||
if (_Py_Finalizing && tstate != _Py_Finalizing) {
|
||||
drop_gil(tstate);
|
||||
PyThread_exit_thread();
|
||||
assert(0); /* unreachable */
|
||||
}
|
||||
errno = err;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue