diff options
author | Kumar Aditya <kumaraditya@python.org> | 2024-12-31 13:40:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-31 13:40:06 (GMT) |
commit | e389d6c650ddacb55b08b657f1e4e9b1330f3455 (patch) | |
tree | 1a7593dbd97e310e8a5b31dafe24e5274c8a1f3f /Python | |
parent | b2ac70a62ad1be8e037ce45ccf5f1b753ea5e64b (diff) | |
download | cpython-e389d6c650ddacb55b08b657f1e4e9b1330f3455.zip cpython-e389d6c650ddacb55b08b657f1e4e9b1330f3455.tar.gz cpython-e389d6c650ddacb55b08b657f1e4e9b1330f3455.tar.bz2 |
gh-128277: make globals variables thread safe in socket module (#128286)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/fileutils.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c index 9529b14..8127665 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -1468,14 +1468,14 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works) assert(!(atomic_flag_works != NULL && inheritable)); if (atomic_flag_works != NULL && !inheritable) { - if (*atomic_flag_works == -1) { + if (_Py_atomic_load_int_relaxed(atomic_flag_works) == -1) { int isInheritable = get_inheritable(fd, raise); if (isInheritable == -1) return -1; - *atomic_flag_works = !isInheritable; + _Py_atomic_store_int_relaxed(atomic_flag_works, !isInheritable); } - if (*atomic_flag_works) + if (_Py_atomic_load_int_relaxed(atomic_flag_works)) return 0; } |