Lines Matching refs:tstate
95 static void _PyGILState_NoteThreadState(PyThreadState* tstate);
339 PyThreadState *tstate = PyInterpreterState_ThreadHead(interp); in _PyInterpreterState_IDDecref() local
341 PyThreadState *save_tstate = PyThreadState_Swap(tstate); in _PyInterpreterState_IDDecref()
342 Py_EndInterpreter(tstate); in _PyInterpreterState_IDDecref()
358 PyThreadState *tstate = (PyThreadState *)PyMem_RawMalloc(sizeof(PyThreadState)); in new_threadstate() local
363 if (tstate != NULL) { in new_threadstate()
364 tstate->interp = interp; in new_threadstate()
366 tstate->frame = NULL; in new_threadstate()
367 tstate->recursion_depth = 0; in new_threadstate()
368 tstate->overflowed = 0; in new_threadstate()
369 tstate->recursion_critical = 0; in new_threadstate()
370 tstate->stackcheck_counter = 0; in new_threadstate()
371 tstate->tracing = 0; in new_threadstate()
372 tstate->use_tracing = 0; in new_threadstate()
373 tstate->gilstate_counter = 0; in new_threadstate()
374 tstate->async_exc = NULL; in new_threadstate()
375 tstate->thread_id = PyThread_get_thread_ident(); in new_threadstate()
377 tstate->dict = NULL; in new_threadstate()
379 tstate->curexc_type = NULL; in new_threadstate()
380 tstate->curexc_value = NULL; in new_threadstate()
381 tstate->curexc_traceback = NULL; in new_threadstate()
383 tstate->exc_state.exc_type = NULL; in new_threadstate()
384 tstate->exc_state.exc_value = NULL; in new_threadstate()
385 tstate->exc_state.exc_traceback = NULL; in new_threadstate()
386 tstate->exc_state.previous_item = NULL; in new_threadstate()
387 tstate->exc_info = &tstate->exc_state; in new_threadstate()
389 tstate->c_profilefunc = NULL; in new_threadstate()
390 tstate->c_tracefunc = NULL; in new_threadstate()
391 tstate->c_profileobj = NULL; in new_threadstate()
392 tstate->c_traceobj = NULL; in new_threadstate()
394 tstate->trash_delete_nesting = 0; in new_threadstate()
395 tstate->trash_delete_later = NULL; in new_threadstate()
396 tstate->on_delete = NULL; in new_threadstate()
397 tstate->on_delete_data = NULL; in new_threadstate()
399 tstate->coroutine_origin_tracking_depth = 0; in new_threadstate()
401 tstate->coroutine_wrapper = NULL; in new_threadstate()
402 tstate->in_coroutine_wrapper = 0; in new_threadstate()
404 tstate->async_gen_firstiter = NULL; in new_threadstate()
405 tstate->async_gen_finalizer = NULL; in new_threadstate()
407 tstate->context = NULL; in new_threadstate()
408 tstate->context_ver = 1; in new_threadstate()
410 tstate->id = ++interp->tstate_next_unique_id; in new_threadstate()
413 _PyThreadState_Init(tstate); in new_threadstate()
416 tstate->prev = NULL; in new_threadstate()
417 tstate->next = interp->tstate_head; in new_threadstate()
418 if (tstate->next) in new_threadstate()
419 tstate->next->prev = tstate; in new_threadstate()
420 interp->tstate_head = tstate; in new_threadstate()
424 return tstate; in new_threadstate()
440 _PyThreadState_Init(PyThreadState *tstate) in _PyThreadState_Init() argument
442 _PyGILState_NoteThreadState(tstate); in _PyThreadState_Init()
565 PyThreadState_Clear(PyThreadState *tstate) in PyThreadState_Clear() argument
567 if (Py_VerboseFlag && tstate->frame != NULL) in PyThreadState_Clear()
571 Py_CLEAR(tstate->frame); in PyThreadState_Clear()
573 Py_CLEAR(tstate->dict); in PyThreadState_Clear()
574 Py_CLEAR(tstate->async_exc); in PyThreadState_Clear()
576 Py_CLEAR(tstate->curexc_type); in PyThreadState_Clear()
577 Py_CLEAR(tstate->curexc_value); in PyThreadState_Clear()
578 Py_CLEAR(tstate->curexc_traceback); in PyThreadState_Clear()
580 Py_CLEAR(tstate->exc_state.exc_type); in PyThreadState_Clear()
581 Py_CLEAR(tstate->exc_state.exc_value); in PyThreadState_Clear()
582 Py_CLEAR(tstate->exc_state.exc_traceback); in PyThreadState_Clear()
585 if (Py_VerboseFlag && tstate->exc_info != &tstate->exc_state) { in PyThreadState_Clear()
590 tstate->c_profilefunc = NULL; in PyThreadState_Clear()
591 tstate->c_tracefunc = NULL; in PyThreadState_Clear()
592 Py_CLEAR(tstate->c_profileobj); in PyThreadState_Clear()
593 Py_CLEAR(tstate->c_traceobj); in PyThreadState_Clear()
595 Py_CLEAR(tstate->coroutine_wrapper); in PyThreadState_Clear()
596 Py_CLEAR(tstate->async_gen_firstiter); in PyThreadState_Clear()
597 Py_CLEAR(tstate->async_gen_finalizer); in PyThreadState_Clear()
599 Py_CLEAR(tstate->context); in PyThreadState_Clear()
605 tstate_delete_common(PyThreadState *tstate) in tstate_delete_common() argument
608 if (tstate == NULL) in tstate_delete_common()
610 interp = tstate->interp; in tstate_delete_common()
614 if (tstate->prev) in tstate_delete_common()
615 tstate->prev->next = tstate->next; in tstate_delete_common()
617 interp->tstate_head = tstate->next; in tstate_delete_common()
618 if (tstate->next) in tstate_delete_common()
619 tstate->next->prev = tstate->prev; in tstate_delete_common()
621 if (tstate->on_delete != NULL) { in tstate_delete_common()
622 tstate->on_delete(tstate->on_delete_data); in tstate_delete_common()
624 PyMem_RawFree(tstate); in tstate_delete_common()
629 PyThreadState_Delete(PyThreadState *tstate) in PyThreadState_Delete() argument
631 if (tstate == GET_TSTATE()) in PyThreadState_Delete()
634 PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey) == tstate) in PyThreadState_Delete()
638 tstate_delete_common(tstate); in PyThreadState_Delete()
645 PyThreadState *tstate = GET_TSTATE(); in PyThreadState_DeleteCurrent() local
646 if (tstate == NULL) in PyThreadState_DeleteCurrent()
649 tstate_delete_common(tstate); in PyThreadState_DeleteCurrent()
651 PyThread_tss_get(&_PyRuntime.gilstate.autoTSSkey) == tstate) in PyThreadState_DeleteCurrent()
668 _PyThreadState_DeleteExcept(PyThreadState *tstate) in _PyThreadState_DeleteExcept() argument
670 PyInterpreterState *interp = tstate->interp; in _PyThreadState_DeleteExcept()
677 if (garbage == tstate) in _PyThreadState_DeleteExcept()
678 garbage = tstate->next; in _PyThreadState_DeleteExcept()
679 if (tstate->prev) in _PyThreadState_DeleteExcept()
680 tstate->prev->next = tstate->next; in _PyThreadState_DeleteExcept()
681 if (tstate->next) in _PyThreadState_DeleteExcept()
682 tstate->next->prev = tstate->prev; in _PyThreadState_DeleteExcept()
683 tstate->prev = tstate->next = NULL; in _PyThreadState_DeleteExcept()
684 interp->tstate_head = tstate; in _PyThreadState_DeleteExcept()
707 PyThreadState *tstate = GET_TSTATE(); in PyThreadState_Get() local
708 if (tstate == NULL) in PyThreadState_Get()
711 return tstate; in PyThreadState_Get()
749 PyThreadState *tstate = GET_TSTATE(); in PyThreadState_GetDict() local
750 if (tstate == NULL) in PyThreadState_GetDict()
753 if (tstate->dict == NULL) { in PyThreadState_GetDict()
755 tstate->dict = d = PyDict_New(); in PyThreadState_GetDict()
759 return tstate->dict; in PyThreadState_GetDict()
833 PyThreadState_Next(PyThreadState *tstate) { in PyThreadState_Next() argument
834 return tstate->next; in PyThreadState_Next()
896 PyThreadState_IsCurrent(PyThreadState *tstate) in PyThreadState_IsCurrent() argument
899 assert(PyGILState_GetThisThreadState()==tstate); in PyThreadState_IsCurrent()
900 return tstate == GET_TSTATE(); in PyThreadState_IsCurrent()
953 PyThreadState *tstate = PyGILState_GetThisThreadState(); in _PyGILState_Reinit() local
961 if (tstate && in _PyGILState_Reinit()
962 PyThread_tss_set(&_PyRuntime.gilstate.autoTSSkey, (void *)tstate) != 0) in _PyGILState_Reinit()
974 _PyGILState_NoteThreadState(PyThreadState* tstate) in _PyGILState_NoteThreadState() argument
995 if ((PyThread_tss_set(&_PyRuntime.gilstate.autoTSSkey, (void *)tstate) in _PyGILState_NoteThreadState()
1003 tstate->gilstate_counter = 1; in _PyGILState_NoteThreadState()
1018 PyThreadState *tstate; in PyGILState_Check() local
1027 tstate = GET_TSTATE(); in PyGILState_Check()
1028 if (tstate == NULL) in PyGILState_Check()
1031 return (tstate == PyGILState_GetThisThreadState()); in PyGILState_Check()