Lines Matching defs:tstate
1897 tstate = (PyThreadState *) PYBIND11_TLS_GET_VALUE(internals.tstate);
1899 if (!tstate) {
1903 below. Note we don't save this state with internals.tstate, since we don't
1905 tstate = PyGILState_GetThisThreadState();
1908 if (!tstate) {
1909 tstate = PyThreadState_New(internals.istate);
1911 if (!tstate)
1914 tstate->gilstate_counter = 0;
1915 PYBIND11_TLS_REPLACE_VALUE(internals.tstate, tstate);
1917 release = detail::get_thread_state_unchecked() != tstate;
1923 PyInterpreterState *interp = tstate->interp;
1924 tstate->interp = nullptr;
1926 PyEval_AcquireThread(tstate);
1928 tstate->interp = interp;
1936 ++tstate->gilstate_counter;
1940 --tstate->gilstate_counter;
1942 if (detail::get_thread_state_unchecked() != tstate)
1944 if (tstate->gilstate_counter < 0)
1947 if (tstate->gilstate_counter == 0) {
1952 PyThreadState_Clear(tstate);
1954 PYBIND11_TLS_DELETE_VALUE(detail::get_internals().tstate);
1965 PyThreadState *tstate = nullptr;
1973 // `internals.tstate` for subsequent `gil_scoped_acquire` calls. Otherwise, an
1976 tstate = PyEval_SaveThread();
1978 auto key = internals.tstate;
1983 if (!tstate)
1985 PyEval_RestoreThread(tstate);
1987 auto key = detail::get_internals().tstate;
1988 PYBIND11_TLS_REPLACE_VALUE(key, tstate);
1992 PyThreadState *tstate;