summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/lock.c6
-rw-r--r--Python/pystate.c3
2 files changed, 5 insertions, 4 deletions
diff --git a/Python/lock.c b/Python/lock.c
index 91c66df..5ed95fc 100644
--- a/Python/lock.c
+++ b/Python/lock.c
@@ -277,12 +277,12 @@ _PyEvent_Notify(PyEvent *evt)
void
PyEvent_Wait(PyEvent *evt)
{
- while (!PyEvent_WaitTimed(evt, -1))
+ while (!PyEvent_WaitTimed(evt, -1, /*detach=*/1))
;
}
int
-PyEvent_WaitTimed(PyEvent *evt, PyTime_t timeout_ns)
+PyEvent_WaitTimed(PyEvent *evt, PyTime_t timeout_ns, int detach)
{
for (;;) {
uint8_t v = _Py_atomic_load_uint8(&evt->v);
@@ -298,7 +298,7 @@ PyEvent_WaitTimed(PyEvent *evt, PyTime_t timeout_ns)
uint8_t expected = _Py_HAS_PARKED;
(void) _PyParkingLot_Park(&evt->v, &expected, sizeof(evt->v),
- timeout_ns, NULL, 1);
+ timeout_ns, NULL, detach);
return _Py_atomic_load_uint8(&evt->v) == _Py_LOCKED;
}
diff --git a/Python/pystate.c b/Python/pystate.c
index 78b39c9..9d7b73b 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -2238,7 +2238,8 @@ stop_the_world(struct _stoptheworld_state *stw)
}
PyTime_t wait_ns = 1000*1000; // 1ms (arbitrary, may need tuning)
- if (PyEvent_WaitTimed(&stw->stop_event, wait_ns)) {
+ int detach = 0;
+ if (PyEvent_WaitTimed(&stw->stop_event, wait_ns, detach)) {
assert(stw->thread_countdown == 0);
break;
}