Struct simics_api_sys::_ts
source · #[repr(C)]pub struct _ts {Show 33 fields
pub prev: *mut _ts,
pub next: *mut _ts,
pub interp: *mut PyInterpreterState,
pub frame: *mut PyFrameObject,
pub recursion_depth: c_int,
pub recursion_headroom: c_int,
pub stackcheck_counter: c_int,
pub tracing: c_int,
pub cframe: *mut CFrame,
pub c_profilefunc: Py_tracefunc,
pub c_tracefunc: Py_tracefunc,
pub c_profileobj: *mut PyObject,
pub c_traceobj: *mut PyObject,
pub curexc_type: *mut PyObject,
pub curexc_value: *mut PyObject,
pub curexc_traceback: *mut PyObject,
pub exc_state: _PyErr_StackItem,
pub exc_info: *mut _PyErr_StackItem,
pub dict: *mut PyObject,
pub gilstate_counter: c_int,
pub async_exc: *mut PyObject,
pub thread_id: c_ulong,
pub trash_delete_nesting: c_int,
pub trash_delete_later: *mut PyObject,
pub on_delete: Option<unsafe extern "C" fn(arg1: *mut c_void)>,
pub on_delete_data: *mut c_void,
pub coroutine_origin_tracking_depth: c_int,
pub async_gen_firstiter: *mut PyObject,
pub async_gen_finalizer: *mut PyObject,
pub context: *mut PyObject,
pub context_ver: u64,
pub id: u64,
pub root_cframe: CFrame,
}
Expand description
Forward declarations for PyThreadState
Fields§
§prev: *mut _ts
See Python/ceval.c for comments explaining most fields
next: *mut _ts
§interp: *mut PyInterpreterState
§frame: *mut PyFrameObject
Borrowed reference to the current frame (it can be NULL)
recursion_depth: c_int
§recursion_headroom: c_int
Allow 50 more calls to handle any errors.
stackcheck_counter: c_int
§tracing: c_int
‘tracing’ keeps track of the execution depth when tracing/profiling. This is to prevent the actual trace/profile code from being recorded in the trace/profile.
cframe: *mut CFrame
Pointer to current CFrame in the C stack frame of the currently, or most recently, executing _PyEval_EvalFrameDefault.
c_profilefunc: Py_tracefunc
§c_tracefunc: Py_tracefunc
§c_profileobj: *mut PyObject
§c_traceobj: *mut PyObject
§curexc_type: *mut PyObject
The exception currently being raised
curexc_value: *mut PyObject
§curexc_traceback: *mut PyObject
§exc_state: _PyErr_StackItem
The exception currently being handled, if no coroutines/generators are present. Always last element on the stack referred to be exc_info.
exc_info: *mut _PyErr_StackItem
Pointer to the top of the stack of the exceptions currently being handled
dict: *mut PyObject
Stores per-thread state
gilstate_counter: c_int
§async_exc: *mut PyObject
Asynchronous exception to raise
thread_id: c_ulong
Thread id where this tstate was created
trash_delete_nesting: c_int
§trash_delete_later: *mut PyObject
§on_delete: Option<unsafe extern "C" fn(arg1: *mut c_void)>
Called when a thread state is deleted normally, but not when it is destroyed after fork(). Pain: to prevent rare but fatal shutdown errors (issue 18808), Thread.join() must wait for the join’ed thread’s tstate to be unlinked from the tstate chain. That happens at the end of a thread’s life, in pystate.c. The obvious way doesn’t quite work: create a lock which the tstate unlinking code releases, and have Thread.join() wait to acquire that lock. The problem is that we are at the end of the thread’s life: if the thread holds the last reference to the lock, decref’ing the lock will delete the lock, and that may trigger arbitrary Python code if there’s a weakref, with a callback, to the lock. But by this time _PyRuntime.gilstate.tstate_current is already NULL, so only the simplest of C code can be allowed to run (in particular it must not be possible to release the GIL). So instead of holding the lock directly, the tstate holds a weakref to the lock: that’s the value of on_delete_data below. Decref’ing a weakref is harmless. on_delete points to _threadmodule.c’s static release_sentinel() function. After the tstate is unlinked, release_sentinel is called with the weakref-to-lock (on_delete_data) argument, and release_sentinel releases the indirectly held lock.
on_delete_data: *mut c_void
§coroutine_origin_tracking_depth: c_int
§async_gen_firstiter: *mut PyObject
§async_gen_finalizer: *mut PyObject
§context: *mut PyObject
§context_ver: u64
§id: u64
Unique thread state id.
root_cframe: CFrame
Trait Implementations§
source§impl Ord for _ts
impl Ord for _ts
source§impl PartialOrd for _ts
impl PartialOrd for _ts
impl Copy for _ts
impl Eq for _ts
impl StructuralPartialEq for _ts
Auto Trait Implementations§
impl Freeze for _ts
impl RefUnwindSafe for _ts
impl !Send for _ts
impl !Sync for _ts
impl Unpin for _ts
impl UnwindSafe for _ts
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)