Skip to content

Commit 7c7d96e

Browse files
committed
Use _Py_IsMainThread() instead
1 parent 0ccd43c commit 7c7d96e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Python/parking_lot.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,12 @@ _PySemaphore_PlatformWait(_PySemaphore *sema, PyTime_t timeout)
115115
HANDLE handles[2] = { sema->platform_sem, NULL };
116116
HANDLE sigint_event = NULL;
117117
DWORD count = 1;
118-
if (_PyOS_IsMainThread()) {
118+
if (_Py_IsMainThread()) {
119119
// gh-135099: Wait on the SIGINT event only in the main thread. Other
120120
// threads would ignore the result anyways, and accessing
121-
// `_PyOS_SigintEvent()` from non-main threads may race with
122-
// interpreter shutdown, which closes the event handle.
121+
// `_PyOS_SigintEvent()` from non-main threads may race with
122+
// interpreter shutdown, which closes the event handle. Note that
123+
// non-main interpreters will ignore the result.
123124
sigint_event = _PyOS_SigintEvent();
124125
if (sigint_event != NULL) {
125126
handles[1] = sigint_event;

0 commit comments

Comments
 (0)