Skip to content

Commit b577db5

Browse files
committed
Improve comments
1 parent 161cd38 commit b577db5

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Modules/signalmodule.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ trip_signal(int sig_num)
244244
_PyEval_SignalReceived();
245245

246246
/* And then write to the wakeup fd *after* setting all the globals and
247-
doing the Py_AddPendingCall. We used to write to the wakeup fd and then
248-
set the flag, but this allowed the following sequence of events
249-
(especially on windows, where trip_signal runs in a new thread):
247+
doing the _PyEval_SignalReceived. We used to write to the wakeup fd
248+
and then set the flag, but this allowed the following sequence of events
249+
(especially on windows, where trip_signal may run in a new thread):
250250
251251
- main thread blocks on select([wakeup_fd], ...)
252252
- signal arrives
@@ -281,6 +281,8 @@ trip_signal(int sig_num)
281281
wakeup.send_err_set = 1;
282282
wakeup.send_errno = errno;
283283
wakeup.send_win_error = GetLastError();
284+
/* Py_AddPendingCall() isn't signal-safe, but we
285+
still use it for this exceptional case. */
284286
Py_AddPendingCall(report_wakeup_send_error, NULL);
285287
}
286288
}
@@ -294,6 +296,8 @@ trip_signal(int sig_num)
294296
rc = _Py_write_noraise(fd, &byte, 1);
295297

296298
if (rc < 0) {
299+
/* Py_AddPendingCall() isn't signal-safe, but we
300+
still use it for this exceptional case. */
297301
Py_AddPendingCall(report_wakeup_write_error,
298302
(void *)(intptr_t)errno);
299303
}

Python/ceval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ _PyEval_SignalReceived(void)
392392
{
393393
/* bpo-30703: Function called when the C signal handler of Python gets a
394394
signal. We cannot queue a callback using Py_AddPendingCall() since this
395-
function is not reentrant (use a lock and a list). */
395+
function is not reentrant (uses a lock and a list). */
396396
SIGNAL_PENDING_CALLS();
397397
}
398398

@@ -419,7 +419,7 @@ Py_MakePendingCalls(void)
419419
busy = 1;
420420

421421
/* Python signal handler doesn't really queue a callback: it only signals
422-
that an UNIX signal was received, see _PyEval_SignalReceived(). */
422+
that a signal was received, see _PyEval_SignalReceived(). */
423423
UNSIGNAL_PENDING_CALLS();
424424
if (PyErr_CheckSignals() < 0) {
425425
SIGNAL_PENDING_CALLS();

0 commit comments

Comments
 (0)