[WIP] bpo-30703: More reentrant signal handler by vstinner · Pull Request #2408 · python/cpython · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpo-30703: More reentrant signal handler
Modify the signal handler to not call Py_AddPendingCall() function
since this function uses a lock and a list, and so is unlikely to be
reentrant. Add a new _PyEval_SignalReceived() function which only
writes into an atomic variable and so is reentrant.
  • Loading branch information
vstinner committed Jun 26, 2017
commit fb11664cb710841df0fe2ff06db745f9566b6010
1 change: 1 addition & 0 deletions Include/ceval.h
2 changes: 1 addition & 1 deletion Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ trip_signal(int sig_num)
/* Set is_tripped after setting .tripped, as it gets
cleared in PyErr_CheckSignals() before .tripped. */
is_tripped = 1;
Py_AddPendingCall(checksignals_witharg, NULL);
_PyEval_SignalReceived();
}

/* And then write to the wakeup fd *after* setting all the globals and
Expand Down
15 changes: 15 additions & 0 deletions Python/ceval.c