Skip to content

Commit 8145caa

Browse files
current_tss_*() -> gilstate_tss_*().
1 parent e8d9d68 commit 8145caa

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

Python/pystate.c

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -164,34 +164,34 @@ tstate_tss_reinit(Py_tss_t *key)
164164
The GIL does no need to be held for these.
165165
*/
166166

167-
#define current_tss_initialized(runtime) \
167+
#define gilstate_tss_initialized(runtime) \
168168
tstate_tss_initialized(&(runtime)->autoTSSkey)
169-
#define current_tss_init(runtime) \
169+
#define gilstate_tss_init(runtime) \
170170
tstate_tss_init(&(runtime)->autoTSSkey)
171-
#define current_tss_fini(runtime) \
171+
#define gilstate_tss_fini(runtime) \
172172
tstate_tss_fini(&(runtime)->autoTSSkey)
173-
#define current_tss_get(runtime) \
173+
#define gilstate_tss_get(runtime) \
174174
tstate_tss_get(&(runtime)->autoTSSkey)
175-
#define _current_tss_set(runtime, tstate) \
175+
#define _gilstate_tss_set(runtime, tstate) \
176176
tstate_tss_set(&(runtime)->autoTSSkey, tstate)
177-
#define _current_tss_clear(runtime) \
177+
#define _gilstate_tss_clear(runtime) \
178178
tstate_tss_clear(&(runtime)->autoTSSkey)
179-
#define current_tss_reinit(runtime) \
179+
#define gilstate_tss_reinit(runtime) \
180180
tstate_tss_reinit(&(runtime)->autoTSSkey)
181181

182182
static inline void
183-
current_tss_set(_PyRuntimeState *runtime, PyThreadState *tstate)
183+
gilstate_tss_set(_PyRuntimeState *runtime, PyThreadState *tstate)
184184
{
185185
assert(tstate != NULL && tstate->interp->runtime == runtime);
186-
if (_current_tss_set(runtime, tstate) != 0) {
186+
if (_gilstate_tss_set(runtime, tstate) != 0) {
187187
Py_FatalError("failed to set current tstate (TSS)");
188188
}
189189
}
190190

191191
static inline void
192-
current_tss_clear(_PyRuntimeState *runtime)
192+
gilstate_tss_clear(_PyRuntimeState *runtime)
193193
{
194-
if (_current_tss_clear(runtime) != 0) {
194+
if (_gilstate_tss_clear(runtime) != 0) {
195195
Py_FatalError("failed to clear current tstate (TSS)");
196196
}
197197
}
@@ -235,8 +235,8 @@ bind_tstate(PyThreadState *tstate)
235235
(This is a better fix for SF bug #1010677 than the first one attempted.)
236236
*/
237237
// XXX Skipping like this does not play nice with multiple interpreters.
238-
if (current_tss_get(runtime) == NULL) {
239-
current_tss_set(runtime, tstate);
238+
if (gilstate_tss_get(runtime) == NULL) {
239+
gilstate_tss_set(runtime, tstate);
240240
}
241241

242242
tstate->thread_id = PyThread_get_thread_ident();
@@ -260,10 +260,10 @@ unbind_tstate(PyThreadState *tstate)
260260
#endif
261261
_PyRuntimeState *runtime = tstate->interp->runtime;
262262

263-
if (current_tss_initialized(runtime) &&
264-
tstate == current_tss_get(runtime))
263+
if (gilstate_tss_initialized(runtime) &&
264+
tstate == gilstate_tss_get(runtime))
265265
{
266-
current_tss_clear(runtime);
266+
gilstate_tss_clear(runtime);
267267
}
268268

269269
// We leave thread_id and native_thraed_id alone
@@ -297,7 +297,7 @@ holds_gil(PyThreadState *tstate)
297297
assert(tstate != NULL);
298298
_PyRuntimeState *runtime = tstate->interp->runtime;
299299
/* Must be the tstate for this thread */
300-
assert(tstate == current_tss_get(runtime));
300+
assert(tstate == gilstate_tss_get(runtime));
301301
return tstate == current_fast_get(runtime);
302302
}
303303

@@ -430,7 +430,7 @@ _PyRuntimeState_Init(_PyRuntimeState *runtime)
430430
memcpy(runtime, &initial, sizeof(*runtime));
431431
}
432432

433-
if (current_tss_init(runtime) != 0) {
433+
if (gilstate_tss_init(runtime) != 0) {
434434
_PyRuntimeState_Fini(runtime);
435435
return _PyStatus_NO_MEMORY();
436436
}
@@ -449,8 +449,8 @@ _PyRuntimeState_Init(_PyRuntimeState *runtime)
449449
void
450450
_PyRuntimeState_Fini(_PyRuntimeState *runtime)
451451
{
452-
if (current_tss_initialized(runtime)) {
453-
current_tss_fini(runtime);
452+
if (gilstate_tss_initialized(runtime)) {
453+
gilstate_tss_fini(runtime);
454454
}
455455

456456
if (PyThread_tss_is_created(&runtime->trashTSSkey)) {
@@ -510,7 +510,7 @@ _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime)
510510

511511
}
512512

513-
PyStatus status = current_tss_reinit(runtime);
513+
PyStatus status = gilstate_tss_reinit(runtime);
514514
if (_PyStatus_EXCEPTION(status)) {
515515
return status;
516516
}
@@ -1671,12 +1671,12 @@ _PyThreadState_Swap(_PyRuntimeState *runtime, PyThreadState *newts)
16711671
*/
16721672
// XXX The above isn't true when multiple interpreters are involved.
16731673
#if defined(Py_DEBUG)
1674-
if (newts && current_tss_initialized(runtime)) {
1674+
if (newts && gilstate_tss_initialized(runtime)) {
16751675
/* This can be called from PyEval_RestoreThread(). Similar
16761676
to it, we need to ensure errno doesn't change.
16771677
*/
16781678
int err = errno;
1679-
PyThreadState *check = current_tss_get(runtime);
1679+
PyThreadState *check = gilstate_tss_get(runtime);
16801680
if (check && check->interp == newts->interp && check != newts) {
16811681
Py_FatalError("Invalid thread state for this thread");
16821682
}
@@ -1985,7 +1985,7 @@ _PyGILState_Init(PyInterpreterState *interp)
19851985
return _PyStatus_OK();
19861986
}
19871987
_PyRuntimeState *runtime = interp->runtime;
1988-
assert(current_tss_get(runtime) == NULL);
1988+
assert(gilstate_tss_get(runtime) == NULL);
19891989
assert(runtime->gilstate.autoInterpreterState == NULL);
19901990
runtime->gilstate.autoInterpreterState = interp;
19911991
return _PyStatus_OK();
@@ -2021,7 +2021,7 @@ _PyGILState_SetTstate(PyThreadState *tstate)
20212021
_PyRuntimeState *runtime = tstate->interp->runtime;
20222022

20232023
assert(runtime->gilstate.autoInterpreterState == tstate->interp);
2024-
assert(current_tss_get(runtime) == tstate);
2024+
assert(gilstate_tss_get(runtime) == tstate);
20252025
assert(tstate->gilstate_counter == 1);
20262026
#endif
20272027

@@ -2040,10 +2040,10 @@ PyThreadState *
20402040
PyGILState_GetThisThreadState(void)
20412041
{
20422042
_PyRuntimeState *runtime = &_PyRuntime;
2043-
if (!current_tss_initialized(runtime)) {
2043+
if (!gilstate_tss_initialized(runtime)) {
20442044
return NULL;
20452045
}
2046-
return current_tss_get(runtime);
2046+
return gilstate_tss_get(runtime);
20472047
}
20482048

20492049
int
@@ -2054,7 +2054,7 @@ PyGILState_Check(void)
20542054
return 1;
20552055
}
20562056

2057-
if (!current_tss_initialized(runtime)) {
2057+
if (!gilstate_tss_initialized(runtime)) {
20582058
return 1;
20592059
}
20602060

@@ -2063,7 +2063,7 @@ PyGILState_Check(void)
20632063
return 0;
20642064
}
20652065

2066-
return (tstate == current_tss_get(runtime));
2066+
return (tstate == gilstate_tss_get(runtime));
20672067
}
20682068

20692069
PyGILState_STATE
@@ -2079,10 +2079,10 @@ PyGILState_Ensure(void)
20792079
/* Ensure that _PyEval_InitThreads() and _PyGILState_Init() have been
20802080
called by Py_Initialize() */
20812081
assert(_PyEval_ThreadsInitialized(runtime));
2082-
assert(current_tss_initialized(runtime));
2082+
assert(gilstate_tss_initialized(runtime));
20832083
assert(runtime->gilstate.autoInterpreterState != NULL);
20842084

2085-
PyThreadState *tcur = current_tss_get(runtime);
2085+
PyThreadState *tcur = gilstate_tss_get(runtime);
20862086
int has_gil;
20872087
if (tcur == NULL) {
20882088
/* Create a new Python thread state for this thread */
@@ -2120,7 +2120,7 @@ void
21202120
PyGILState_Release(PyGILState_STATE oldstate)
21212121
{
21222122
_PyRuntimeState *runtime = &_PyRuntime;
2123-
PyThreadState *tstate = current_tss_get(runtime);
2123+
PyThreadState *tstate = gilstate_tss_get(runtime);
21242124
if (tstate == NULL) {
21252125
Py_FatalError("auto-releasing thread-state, "
21262126
"but no thread-state for this thread");

0 commit comments

Comments
 (0)