void PyThreadState_Delete(PyThreadState *tstate) { if (tstate == _PyThreadState_Current) Py_FatalError("PyThreadState_Delete: tstate is still current"); tstate_delete_common(tstate); #ifdef WITH_THREAD if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) PyThread_delete_key_value(autoTLSkey); #endif /* WITH_THREAD */ }
void PyThreadState_DeleteCurrent() { PyThreadState *tstate = _PyThreadState_Current; if (tstate == NULL) Py_FatalError( "PyThreadState_DeleteCurrent: no current tstate"); _PyThreadState_Current = NULL; tstate_delete_common(tstate); if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) PyThread_delete_key_value(autoTLSkey); PyEval_ReleaseLock(); }
static inline void pyg_restore_current_main_loop (GMainLoop *main_loop) { GMainLoop *prev; g_return_if_fail (pyg_current_main_loop_key != -1); prev = PyThread_get_key_value(pyg_current_main_loop_key); if (prev != NULL) g_main_loop_unref(prev); PyThread_delete_key_value(pyg_current_main_loop_key); if (main_loop != NULL) PyThread_set_key_value(pyg_current_main_loop_key, main_loop); }
void PyThreadState_DeleteCurrent() { PyThreadState *tstate = (PyThreadState*)_Py_atomic_load_relaxed( &_PyThreadState_Current); if (tstate == NULL) Py_FatalError( "PyThreadState_DeleteCurrent: no current tstate"); _Py_atomic_store_relaxed(&_PyThreadState_Current, NULL); if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) PyThread_delete_key_value(autoTLSkey); tstate_delete_common(tstate); PyEval_ReleaseLock(); }
static inline GMainLoop * pyg_save_current_main_loop (GMainLoop *main_loop) { GMainLoop *retval; g_return_val_if_fail(main_loop != NULL, NULL); if (pyg_current_main_loop_key == -1) pyg_current_main_loop_key = PyThread_create_key(); retval = PyThread_get_key_value(pyg_current_main_loop_key); PyThread_delete_key_value(pyg_current_main_loop_key); PyThread_set_key_value(pyg_current_main_loop_key, g_main_loop_ref(main_loop)); return retval; }