• Home
  • Raw
  • Download

Lines Matching full:runtime

49 _PyRuntimeState_Init_impl(_PyRuntimeState *runtime)  in _PyRuntimeState_Init_impl()  argument
52 currently no public API to set it between runtime in _PyRuntimeState_Init_impl()
54 void *open_code_hook = runtime->open_code_hook; in _PyRuntimeState_Init_impl()
55 void *open_code_userdata = runtime->open_code_userdata; in _PyRuntimeState_Init_impl()
56 _Py_AuditHookEntry *audit_hook_head = runtime->audit_hook_head; in _PyRuntimeState_Init_impl()
59 Py_ssize_t unicode_next_index = runtime->unicode_ids.next_index; in _PyRuntimeState_Init_impl()
61 memset(runtime, 0, sizeof(*runtime)); in _PyRuntimeState_Init_impl()
63 runtime->open_code_hook = open_code_hook; in _PyRuntimeState_Init_impl()
64 runtime->open_code_userdata = open_code_userdata; in _PyRuntimeState_Init_impl()
65 runtime->audit_hook_head = audit_hook_head; in _PyRuntimeState_Init_impl()
67 _PyEval_InitRuntimeState(&runtime->ceval); in _PyRuntimeState_Init_impl()
69 PyPreConfig_InitPythonConfig(&runtime->preconfig); in _PyRuntimeState_Init_impl()
71 runtime->gilstate.check_enabled = 1; in _PyRuntimeState_Init_impl()
76 runtime->gilstate.autoTSSkey = initial; in _PyRuntimeState_Init_impl()
78 runtime->interpreters.mutex = PyThread_allocate_lock(); in _PyRuntimeState_Init_impl()
79 if (runtime->interpreters.mutex == NULL) { in _PyRuntimeState_Init_impl()
82 runtime->interpreters.next_id = -1; in _PyRuntimeState_Init_impl()
84 runtime->xidregistry.mutex = PyThread_allocate_lock(); in _PyRuntimeState_Init_impl()
85 if (runtime->xidregistry.mutex == NULL) { in _PyRuntimeState_Init_impl()
90 runtime->main_thread = PyThread_get_thread_ident(); in _PyRuntimeState_Init_impl()
92 runtime->unicode_ids.lock = PyThread_allocate_lock(); in _PyRuntimeState_Init_impl()
93 if (runtime->unicode_ids.lock == NULL) { in _PyRuntimeState_Init_impl()
96 runtime->unicode_ids.next_index = unicode_next_index; in _PyRuntimeState_Init_impl()
102 _PyRuntimeState_Init(_PyRuntimeState *runtime) in _PyRuntimeState_Init() argument
109 PyStatus status = _PyRuntimeState_Init_impl(runtime); in _PyRuntimeState_Init()
116 _PyRuntimeState_Fini(_PyRuntimeState *runtime) in _PyRuntimeState_Fini() argument
127 FREE_LOCK(runtime->interpreters.mutex); in _PyRuntimeState_Fini()
128 FREE_LOCK(runtime->xidregistry.mutex); in _PyRuntimeState_Fini()
129 FREE_LOCK(runtime->unicode_ids.lock); in _PyRuntimeState_Fini()
139 _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime) in _PyRuntimeState_ReInitThreads() argument
142 runtime->main_thread = PyThread_get_thread_ident(); in _PyRuntimeState_ReInitThreads()
149 int reinit_interp = _PyThread_at_fork_reinit(&runtime->interpreters.mutex); in _PyRuntimeState_ReInitThreads()
150 int reinit_xidregistry = _PyThread_at_fork_reinit(&runtime->xidregistry.mutex); in _PyRuntimeState_ReInitThreads()
151 int reinit_unicode_ids = _PyThread_at_fork_reinit(&runtime->unicode_ids.lock); in _PyRuntimeState_ReInitThreads()
157 int reinit_main_id = _PyThread_at_fork_reinit(&runtime->interpreters.main->id_mutex); in _PyRuntimeState_ReInitThreads()
164 return _PyStatus_ERR("Failed to reinitialize runtime locks"); in _PyRuntimeState_ReInitThreads()
171 #define HEAD_LOCK(runtime) \ argument
172 PyThread_acquire_lock((runtime)->interpreters.mutex, WAIT_LOCK)
173 #define HEAD_UNLOCK(runtime) \ argument
174 PyThread_release_lock((runtime)->interpreters.mutex)
181 _PyInterpreterState_Enable(_PyRuntimeState *runtime) in _PyInterpreterState_Enable() argument
183 struct pyinterpreters *interpreters = &runtime->interpreters; in _PyInterpreterState_Enable()
223 /* Don't get runtime from tstate since tstate can be NULL */ in PyInterpreterState_New()
224 _PyRuntimeState *runtime = &_PyRuntime; in PyInterpreterState_New() local
225 interp->runtime = runtime; in PyInterpreterState_New()
244 struct pyinterpreters *interpreters = &runtime->interpreters; in PyInterpreterState_New()
246 HEAD_LOCK(runtime); in PyInterpreterState_New()
265 HEAD_UNLOCK(runtime); in PyInterpreterState_New()
290 _PyRuntimeState *runtime = interp->runtime; in interpreter_clear() local
296 HEAD_LOCK(runtime); in interpreter_clear()
300 HEAD_UNLOCK(runtime); in interpreter_clear()
380 _PyRuntimeState *runtime = interp->runtime; in PyInterpreterState_Delete() local
381 struct pyinterpreters *interpreters = &runtime->interpreters; in PyInterpreterState_Delete()
387 _PyThreadState_Swap(&runtime->gilstate, NULL); in PyInterpreterState_Delete()
389 HEAD_LOCK(runtime); in PyInterpreterState_Delete()
410 HEAD_UNLOCK(runtime); in PyInterpreterState_Delete()
425 _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime) in _PyInterpreterState_DeleteExceptMain() argument
427 struct _gilstate_runtime_state *gilstate = &runtime->gilstate; in _PyInterpreterState_DeleteExceptMain()
428 struct pyinterpreters *interpreters = &runtime->interpreters; in _PyInterpreterState_DeleteExceptMain()
435 HEAD_LOCK(runtime); in _PyInterpreterState_DeleteExceptMain()
455 HEAD_UNLOCK(runtime); in _PyInterpreterState_DeleteExceptMain()
491 interp_look_up_id(_PyRuntimeState *runtime, int64_t requested_id) in interp_look_up_id() argument
493 PyInterpreterState *interp = runtime->interpreters.head; in interp_look_up_id()
512 _PyRuntimeState *runtime = &_PyRuntime; in _PyInterpreterState_LookUpID() local
513 HEAD_LOCK(runtime); in _PyInterpreterState_LookUpID()
514 interp = interp_look_up_id(runtime, requested_id); in _PyInterpreterState_LookUpID()
515 HEAD_UNLOCK(runtime); in _PyInterpreterState_LookUpID()
616 _PyRuntimeState *runtime = interp->runtime; in new_threadstate() local
669 HEAD_LOCK(runtime); in new_threadstate()
676 HEAD_UNLOCK(runtime); in new_threadstate()
696 _PyGILState_NoteThreadState(&tstate->interp->runtime->gilstate, tstate); in _PyThreadState_Init()
891 _PyRuntimeState *runtime = interp->runtime; in tstate_delete_common() local
893 HEAD_LOCK(runtime); in tstate_delete_common()
903 HEAD_UNLOCK(runtime); in tstate_delete_common()
916 struct _gilstate_runtime_state *gilstate = &tstate->interp->runtime->gilstate; in _PyThreadState_Delete()
938 struct _gilstate_runtime_state *gilstate = &tstate->interp->runtime->gilstate; in _PyThreadState_DeleteCurrent()
962 _PyThreadState_DeleteExcept(_PyRuntimeState *runtime, PyThreadState *tstate) in _PyThreadState_DeleteExcept() argument
966 HEAD_LOCK(runtime); in _PyThreadState_DeleteExcept()
982 HEAD_UNLOCK(runtime); in _PyThreadState_DeleteExcept()
1126 _PyRuntimeState *runtime = &_PyRuntime; in PyThreadState_SetAsyncExc() local
1127 PyInterpreterState *interp = _PyRuntimeState_GetThreadState(runtime)->interp; in PyThreadState_SetAsyncExc()
1135 HEAD_LOCK(runtime); in PyThreadState_SetAsyncExc()
1151 HEAD_UNLOCK(runtime); in PyThreadState_SetAsyncExc()
1157 HEAD_UNLOCK(runtime); in PyThreadState_SetAsyncExc()
1216 _PyRuntimeState *runtime = tstate->interp->runtime; in _PyThread_CurrentFrames() local
1217 HEAD_LOCK(runtime); in _PyThread_CurrentFrames()
1219 for (i = runtime->interpreters.head; i != NULL; i = i->next) { in _PyThread_CurrentFrames()
1243 HEAD_UNLOCK(runtime); in _PyThread_CurrentFrames()
1269 _PyRuntimeState *runtime = tstate->interp->runtime; in _PyThread_CurrentExceptions() local
1270 HEAD_LOCK(runtime); in _PyThread_CurrentExceptions()
1272 for (i = runtime->interpreters.head; i != NULL; i = i->next) { in _PyThread_CurrentExceptions()
1306 HEAD_UNLOCK(runtime); in _PyThread_CurrentExceptions()
1333 _PyGILState_Init(_PyRuntimeState *runtime) in _PyGILState_Init() argument
1335 struct _gilstate_runtime_state *gilstate = &runtime->gilstate; in _PyGILState_Init()
1359 struct _gilstate_runtime_state *gilstate = &tstate->interp->runtime->gilstate; in _PyGILState_SetTstate()
1378 struct _gilstate_runtime_state *gilstate = &interp->runtime->gilstate; in _PyGILState_Fini()
1389 _PyGILState_Reinit(_PyRuntimeState *runtime) in _PyGILState_Reinit() argument
1391 struct _gilstate_runtime_state *gilstate = &runtime->gilstate; in _PyGILState_Reinit()
1485 _PyRuntimeState *runtime = &_PyRuntime; in PyGILState_Ensure() local
1486 struct _gilstate_runtime_state *gilstate = &runtime->gilstate; in PyGILState_Ensure()
1496 assert(_PyEval_ThreadsInitialized(runtime)); in PyGILState_Ensure()
1535 _PyRuntimeState *runtime = &_PyRuntime; in PyGILState_Release() local
1536 PyThreadState *tstate = PyThread_tss_get(&runtime->gilstate.autoTSSkey); in PyGILState_Release()
1568 assert(_PyRuntimeGILState_GetThreadState(&runtime->gilstate) == tstate); in PyGILState_Release()