summaryrefslogtreecommitdiffstats
path: root/Python/ceval_gil.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval_gil.c')
-rw-r--r--Python/ceval_gil.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/ceval_gil.c b/Python/ceval_gil.c
index d70abbc..f3b1692 100644
--- a/Python/ceval_gil.c
+++ b/Python/ceval_gil.c
@@ -949,6 +949,15 @@ _Py_HandlePending(PyThreadState *tstate)
{
PyInterpreterState *interp = tstate->interp;
+ /* Stop-the-world */
+ if (_Py_eval_breaker_bit_is_set(interp, _PY_EVAL_PLEASE_STOP_BIT)) {
+ _Py_set_eval_breaker_bit(interp, _PY_EVAL_PLEASE_STOP_BIT, 0);
+ _PyThreadState_Suspend(tstate);
+
+ /* The attach blocks until the stop-the-world event is complete. */
+ _PyThreadState_Attach(tstate);
+ }
+
/* Pending signals */
if (_Py_eval_breaker_bit_is_set(interp, _PY_SIGNALS_PENDING_BIT)) {
if (handle_signals(tstate) != 0) {