8000 gh-116908: Only write to `_pending_calls.calls_to_do` with atomic operations by swtaarrs · Pull Request #117044 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-116908: Only write to _pending_calls.calls_to_do with atomic operations #117044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Python/ceval_gil.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ _push_pending_call(struct _pending_calls *pending,
pending->calls[i].flags = flags;
pending->last = j;
assert(pending->calls_to_do < NPENDINGCALLS);
pending->calls_to_do++;
_Py_atomic_add_int32(&pending->calls_to_do, 1);
return 0;
}

Expand Down Expand Up @@ -701,7 +701,7 @@ _pop_pending_call(struct _pending_calls *pending,
pending->calls[i] = (struct _pending_call){0};
pending->first = (i + 1) % NPENDINGCALLS;
assert(pending->calls_to_do > 0);
pending->calls_to_do--;
_Py_atomic_add_int32(&pending->calls_to_do, -1);
}
}

Expand Down
0