8000 gh-59956: Clarify GILState-related Code by ericsnowcurrently · Pull Request #101161 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-59956: Clarify GILState-related Code #101161

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 11 commits into from
Jan 19, 2023
Merged
Prev Previous commit
Next Next commit
Inline the current_tss helpers.
  • Loading branch information
ericsnowcurrently committed Jan 19, 2023
commit 5903b39ff79280a4196e5ef55576a05c772685b5
8 changes: 4 additions & 4 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,29 +74,29 @@ current_tss_fini(_PyRuntimeState *runtime)
PyThread_tss_delete(&runtime->gilstate.autoTSSkey);
}

static PyThreadState *
static inline PyThreadState *
current_tss_get(_PyRuntimeState *runtime)
{
assert(current_tss_initialized(runtime));
return (PyThreadState *)PyThread_tss_get(&runtime->gilstate.autoTSSkey);
}

static int
static inline int
_current_tss_set(_PyRuntimeState *runtime, PyThreadState *tstate)
{
assert(tstate != NULL);
assert(current_tss_initialized(runtime));
return PyThread_tss_set(&runtime->gilstate.autoTSSkey, (void *)tstate);
}
static void
static inline void
current_tss_set(_PyRuntimeState *runtime, PyThreadState *tstate)
{
if (_current_tss_set(runtime, tstate) != 0) {
Py_FatalError("failed to set current tstate (TSS)");
}
}

static void
static inline void
current_tss_clear(_PyRuntimeState *runtime)
{
assert(current_tss_initialized(runtime));
Expand Down
0