diff options
author | Sam Gross <colesbury@gmail.com> | 2024-04-30 19:01:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-30 19:01:28 (GMT) |
commit | b2c3b70c7102197e4505e6cd69722dc508527d22 (patch) | |
tree | 6b910d740f1e3d8d3af38a487d787b3267ebff68 /Include/internal/pycore_lock.h | |
parent | 4a1cf66c5c0afa36d7a51d5f9d3874cda10df79c (diff) | |
download | cpython-b2c3b70c7102197e4505e6cd69722dc508527d22.zip cpython-b2c3b70c7102197e4505e6cd69722dc508527d22.tar.gz cpython-b2c3b70c7102197e4505e6cd69722dc508527d22.tar.bz2 |
gh-118332: Fix deadlock involving stop the world (#118412)
Avoid detaching thread state when stopping the world. When re-attaching
the thread state, the thread would attempt to resume the top-most
critical section, which might now be held by a thread paused for our
stop-the-world request.
Diffstat (limited to 'Include/internal/pycore_lock.h')
-rw-r--r-- | Include/internal/pycore_lock.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Include/internal/pycore_lock.h b/Include/internal/pycore_lock.h index f993c95..a5b28e4 100644 --- a/Include/internal/pycore_lock.h +++ b/Include/internal/pycore_lock.h @@ -150,8 +150,10 @@ PyAPI_FUNC(void) PyEvent_Wait(PyEvent *evt); // Wait for the event to be set, or until the timeout expires. If the event is // already set, then this returns immediately. Returns 1 if the event was set, -// and 0 if the timeout expired or thread was interrupted. -PyAPI_FUNC(int) PyEvent_WaitTimed(PyEvent *evt, PyTime_t timeout_ns); +// and 0 if the timeout expired or thread was interrupted. If `detach` is +// true, then the thread will detach/release the GIL while waiting. +PyAPI_FUNC(int) +PyEvent_WaitTimed(PyEvent *evt, PyTime_t timeout_ns, int detach); // _PyRawMutex implements a word-sized mutex that that does not depend on the // parking lot API, and therefore can be used in the parking lot |