Lines Matching refs:_PyRuntime
91 #define HEAD_LOCK() PyThread_acquire_lock(_PyRuntime.interpreters.mutex, \
93 #define HEAD_UNLOCK() PyThread_release_lock(_PyRuntime.interpreters.mutex)
170 interp->next = _PyRuntime.interpreters.head; in PyInterpreterState_New()
171 if (_PyRuntime.interpreters.main == NULL) { in PyInterpreterState_New()
172 _PyRuntime.interpreters.main = interp; in PyInterpreterState_New()
174 _PyRuntime.interpreters.head = interp; in PyInterpreterState_New()
175 if (_PyRuntime.interpreters.next_id < 0) { in PyInterpreterState_New()
182 interp->id = _PyRuntime.interpreters.next_id; in PyInterpreterState_New()
183 _PyRuntime.interpreters.next_id += 1; in PyInterpreterState_New()
239 for (p = &_PyRuntime.interpreters.head; ; p = &(*p)->next) { in PyInterpreterState_Delete()
249 if (_PyRuntime.interpreters.main == interp) { in PyInterpreterState_Delete()
250 _PyRuntime.interpreters.main = NULL; in PyInterpreterState_Delete()
251 if (_PyRuntime.interpreters.head != NULL) in PyInterpreterState_Delete()
633 if (_PyRuntime.gilstate.autoInterpreterState && in PyThreadState_Delete()
634 PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey) == tstate) in PyThreadState_Delete()
636 PyThread_tss_set(&_PyRuntime.gilstate.autoTSSkey, NULL); in PyThreadState_Delete()
650 if (_PyRuntime.gilstate.autoInterpreterState && in PyThreadState_DeleteCurrent()
651 PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey) == tstate) in PyThreadState_DeleteCurrent()
653 PyThread_tss_set(&_PyRuntime.gilstate.autoTSSkey, NULL); in PyThreadState_DeleteCurrent()
813 return _PyRuntime.interpreters.head; in PyInterpreterState_Head()
819 return _PyRuntime.interpreters.main; in PyInterpreterState_Main()
859 for (i = _PyRuntime.interpreters.head; i != NULL; i = i->next) { in _PyThread_CurrentFrames()
910 if (PyThread_tss_create(&_PyRuntime.gilstate.autoTSSkey) != 0) { in _PyGILState_Init()
913 _PyRuntime.gilstate.autoInterpreterState = i; in _PyGILState_Init()
914 assert(PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey) == NULL); in _PyGILState_Init()
923 return _PyRuntime.gilstate.autoInterpreterState; in _PyGILState_GetInterpreterStateUnsafe()
929 PyThread_tss_delete(&_PyRuntime.gilstate.autoTSSkey); in _PyGILState_Fini()
930 _PyRuntime.gilstate.autoInterpreterState = NULL; in _PyGILState_Fini()
945 _PyRuntime.interpreters.mutex = PyThread_allocate_lock(); in _PyGILState_Reinit()
949 if (_PyRuntime.interpreters.mutex == NULL) { in _PyGILState_Reinit()
954 PyThread_tss_delete(&_PyRuntime.gilstate.autoTSSkey); in _PyGILState_Reinit()
955 if (PyThread_tss_create(&_PyRuntime.gilstate.autoTSSkey) != 0) { in _PyGILState_Reinit()
962 PyThread_tss_set(&_PyRuntime.gilstate.autoTSSkey, (void *)tstate) != 0) in _PyGILState_Reinit()
979 if (!_PyRuntime.gilstate.autoInterpreterState) in _PyGILState_NoteThreadState()
994 if (PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey) == NULL) { in _PyGILState_NoteThreadState()
995 if ((PyThread_tss_set(&_PyRuntime.gilstate.autoTSSkey, (void *)tstate) in _PyGILState_NoteThreadState()
1010 if (_PyRuntime.gilstate.autoInterpreterState == NULL) in PyGILState_GetThisThreadState()
1012 return (PyThreadState *)PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey); in PyGILState_GetThisThreadState()
1023 if (!PyThread_tss_is_created(&_PyRuntime.gilstate.autoTSSkey)) { in PyGILState_Check()
1047 assert(_PyRuntime.gilstate.autoInterpreterState); in PyGILState_Ensure()
1049 tcur = (PyThreadState *)PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey); in PyGILState_Ensure()
1054 tcur = PyThreadState_New(_PyRuntime.gilstate.autoInterpreterState); in PyGILState_Ensure()
1091 &_PyRuntime.gilstate.autoTSSkey); in PyGILState_Release()