Skip to content

Commit

Permalink
gh-13828: fix data raceing for _waiting_release method in _interpchan…
Browse files Browse the repository at this point in the history
…nelsmodule.c

Signed-off-by: Manjusaka <me@manjusaka.me>
  • Loading branch information
Zheaoli committed Sep 15, 2024
1 parent 401fff7 commit d8a89c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Modules/_interpchannelsmodule.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* interpreters module */
/* low-level access to interpreter primitives */

#include <stdbool.h>
#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
#endif
Expand Down Expand Up @@ -490,12 +491,12 @@ _waiting_release(_waiting_t *waiting, int received)
assert(!waiting->received);

waiting->status = WAITING_RELEASING;
PyThread_release_lock(waiting->mutex);
if (waiting->received != received) {
assert(received == 1);
waiting->received = received;
}
waiting->status = WAITING_RELEASED;
PyThread_release_lock(waiting->mutex);
}

static void
Expand Down

0 comments on commit d8a89c1

Please sign in to comment.