Skip to content

Commit d8a89c1

Browse files
committed
gh-13828: fix data raceing for _waiting_release method in _interpchannelsmodule.c
Signed-off-by: Manjusaka <[email protected]>
1 parent 401fff7 commit d8a89c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Modules/_interpchannelsmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* interpreters module */
22
/* low-level access to interpreter primitives */
33

4+
#include <stdbool.h>
45
#ifndef Py_BUILD_CORE_BUILTIN
56
# define Py_BUILD_CORE_MODULE 1
67
#endif
@@ -490,12 +491,12 @@ _waiting_release(_waiting_t *waiting, int received)
490491
assert(!waiting->received);
491492

492493
waiting->status = WAITING_RELEASING;
493-
PyThread_release_lock(waiting->mutex);
494494
if (waiting->received != received) {
495495
assert(received == 1);
496496
waiting->received = received;
497497
}
498498
waiting->status = WAITING_RELEASED;
499+
PyThread_release_lock(waiting->mutex);
499500
}
500501

501502
static void

0 commit comments

Comments
 (0)