Home | History | Annotate | Download | only in Python

Lines Matching refs:tstate

53 static void _PyGILState_NoteThreadState(PyThreadState* tstate);
159 PyThreadState *tstate = (PyThreadState *)malloc(sizeof(PyThreadState));
164 if (tstate != NULL) {
165 tstate->interp = interp;
167 tstate->frame = NULL;
168 tstate->recursion_depth = 0;
169 tstate->tracing = 0;
170 tstate->use_tracing = 0;
171 tstate->tick_counter = 0;
172 tstate->gilstate_counter = 0;
173 tstate->async_exc = NULL;
175 tstate->thread_id = PyThread_get_thread_ident();
177 tstate->thread_id = 0;
180 tstate->dict = NULL;
182 tstate->curexc_type = NULL;
183 tstate->curexc_value = NULL;
184 tstate->curexc_traceback = NULL;
186 tstate->exc_type = NULL;
187 tstate->exc_value = NULL;
188 tstate->exc_traceback = NULL;
190 tstate->c_profilefunc = NULL;
191 tstate->c_tracefunc = NULL;
192 tstate->c_profileobj = NULL;
193 tstate->c_traceobj = NULL;
195 tstate->trash_delete_nesting = 0;
196 tstate->trash_delete_later = NULL;
199 _PyThreadState_Init(tstate);
202 tstate->next = interp->tstate_head;
203 interp->tstate_head = tstate;
207 return tstate;
223 _PyThreadState_Init(PyThreadState *tstate)
226 _PyGILState_NoteThreadState(tstate);
231 PyThreadState_Clear(PyThreadState *tstate)
233 if (Py_VerboseFlag && tstate->frame != NULL)
237 Py_CLEAR(tstate->frame);
239 Py_CLEAR(tstate->dict);
240 Py_CLEAR(tstate->async_exc);
242 Py_CLEAR(tstate->curexc_type);
243 Py_CLEAR(tstate->curexc_value);
244 Py_CLEAR(tstate->curexc_traceback);
246 Py_CLEAR(tstate->exc_type);
247 Py_CLEAR(tstate->exc_value);
248 Py_CLEAR(tstate->exc_traceback);
250 tstate->c_profilefunc = NULL;
251 tstate->c_tracefunc = NULL;
252 Py_CLEAR(tstate->c_profileobj);
253 Py_CLEAR(tstate->c_traceobj);
259 tstate_delete_common(PyThreadState *tstate)
264 if (tstate == NULL)
265 Py_FatalError("PyThreadState_Delete: NULL tstate");
266 interp = tstate->interp;
273 "PyThreadState_Delete: invalid tstate");
274 if (*p == tstate)
283 " and tstate not found.");
288 " tstate not found.");
290 *p = tstate->next;
292 free(tstate);
297 PyThreadState_Delete(PyThreadState *tstate)
299 if (tstate == _PyThreadState_Current)
300 Py_FatalError("PyThreadState_Delete: tstate is still current");
301 tstate_delete_common(tstate);
303 if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate)
313 PyThreadState *tstate = _PyThreadState_Current;
314 if (tstate == NULL)
316 "PyThreadState_DeleteCurrent: no current tstate");
318 if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate)
320 tstate_delete_common(tstate);
393 PyThreadState *tstate = PyThreadState_GET();
394 PyInterpreterState *interp = tstate->interp;
446 PyThreadState_Next(PyThreadState *tstate) {
447 return tstate->next;
510 PyThreadState_IsCurrent(PyThreadState *tstate)
512 /* Must be the tstate for this thread */
513 assert(PyGILState_GetThisThreadState()==tstate);
517 return tstate == _PyThreadState_Current;
548 _PyGILState_NoteThreadState(PyThreadState* tstate)
570 if (PyThread_set_key_value(autoTLSkey, (void *)tstate) < 0)
574 tstate->gilstate_counter = 1;