File tree Expand file tree Collapse file tree 3 files changed +9
-11
lines changed
Expand file tree Collapse file tree 3 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -67,12 +67,12 @@ _Py_ThreadCanHandlePendingCalls(void)
6767static inline PyThreadState *
6868_PyRuntimeState_GetThreadState (_PyRuntimeState * runtime )
6969{
70- return (PyThreadState * )_Py_atomic_load_relaxed (& runtime -> gilstate . tstate_current );
70+ return (PyThreadState * )_Py_atomic_load_relaxed (& runtime -> tstate_current );
7171}
7272
7373/* Get the current Python thread state.
7474
75- Efficient macro reading directly the 'gilstate. tstate_current' atomic
75+ Efficient macro reading directly the 'tstate_current' atomic
7676 variable. The macro is unsafe: it does not check for error and it can
7777 return NULL.
7878
Original file line number Diff line number Diff line change @@ -41,9 +41,6 @@ struct _gilstate_runtime_state {
4141 /* bpo-26558: Flag to disable PyGILState_Check().
4242 If set to non-zero, PyGILState_Check() always return 1. */
4343 int check_enabled ;
44- /* Assuming the current thread holds the GIL, this is the
45- PyThreadState for the current thread. */
46- _Py_atomic_address tstate_current ;
4744 /* The single PyInterpreterState used by this process'
4845 GILState implementation
4946 */
@@ -124,6 +121,10 @@ typedef struct pyruntimestate {
124121
125122 unsigned long main_thread ;
126123
124+ /* Assuming the current thread holds the GIL, this is the
125+ PyThreadState for the current thread. */
126+ _Py_atomic_address tstate_current ;
127+
127128 PyWideStringList orig_argv ;
128129
129130 struct _parser_runtime_state parser ;
Original file line number Diff line number Diff line change @@ -48,25 +48,22 @@ static inline PyThreadState *
4848current_fast_get (_PyRuntimeState * runtime )
4949{
5050 // The GIL must be held by the current thread.
51- return (PyThreadState * )_Py_atomic_load_relaxed (
52- & runtime -> gilstate .tstate_current );
51+ return (PyThreadState * )_Py_atomic_load_relaxed (& runtime -> tstate_current );
5352}
5453
5554static inline void
5655current_fast_set (_PyRuntimeState * runtime , PyThreadState * tstate )
5756{
5857 // The GIL must be held by the current thread.
5958 assert (tstate != NULL );
60- _Py_atomic_store_relaxed (& runtime -> gilstate .tstate_current ,
61- (uintptr_t )tstate );
59+ _Py_atomic_store_relaxed (& runtime -> tstate_current , (uintptr_t )tstate );
6260}
6361
6462static inline void
6563current_fast_clear (_PyRuntimeState * runtime )
6664{
6765 // The GIL must be held by the current thread.
68- _Py_atomic_store_relaxed (& runtime -> gilstate .tstate_current ,
69- (uintptr_t )NULL );
66+ _Py_atomic_store_relaxed (& runtime -> tstate_current , (uintptr_t )NULL );
7067}
7168
7269
You can’t perform that action at this time.
0 commit comments