@@ -244,9 +244,9 @@ trip_signal(int sig_num)
244
244
_PyEval_SignalReceived ();
245
245
246
246
/* 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):
250
250
251
251
- main thread blocks on select([wakeup_fd], ...)
252
252
- signal arrives
@@ -281,6 +281,8 @@ trip_signal(int sig_num)
281
281
wakeup .send_err_set = 1 ;
282
282
wakeup .send_errno = errno ;
283
283
wakeup .send_win_error = GetLastError ();
284
+ /* Py_AddPendingCall() isn't signal-safe, but we
285
+ still use it for this exceptional case. */
284
286
Py_AddPendingCall (report_wakeup_send_error , NULL );
285
287
}
286
288
}
@@ -294,6 +296,8 @@ trip_signal(int sig_num)
294
296
rc = _Py_write_noraise (fd , & byte , 1 );
295
297
296
298
if (rc < 0 ) {
299
+ /* Py_AddPendingCall() isn't signal-safe, but we
300
+ still use it for this exceptional case. */
297
301
Py_AddPendingCall (report_wakeup_write_error ,
298
302
(void * )(intptr_t )errno );
299
303
}
0 commit comments