pub struct Thread(/* private fields */);
Expand description
An object representing a Zircon thread.
As essentially a subtype of Handle
, it can be freely interconverted.
Implementations§
Source§impl Thread
impl Thread
Sourcepub fn start(
&self,
thread_entry: usize,
stack: usize,
arg1: usize,
arg2: usize,
) -> Result<(), Status>
pub fn start( &self, thread_entry: usize, stack: usize, arg1: usize, arg2: usize, ) -> Result<(), Status>
Cause the thread to begin execution.
Wraps the zx_thread_start syscall.
Sourcepub fn set_profile(&self, profile: Profile, options: u32) -> Result<(), Status>
pub fn set_profile(&self, profile: Profile, options: u32) -> Result<(), Status>
Apply a scheduling profile to a thread.
Wraps the zx_object_set_profile syscall.
Sourcepub unsafe fn exit()
pub unsafe fn exit()
Terminate the current running thread.
§Safety
Extreme caution should be used– this is basically always UB in Rust. There’s almost no “normal” program code where this is okay to call. Users should take care that no references could possibly exist to stack variables on this thread, and that any destructors, closure suffixes, or other “after this thing runs” code is waiting to run in order for safety.
Sourcepub fn get_exception_report(&self) -> Result<ExceptionReport, Status>
pub fn get_exception_report(&self) -> Result<ExceptionReport, Status>
Wraps the zx_object_get_info syscall for the ZX_INFO_THREAD_EXCEPTION_REPORT topic.
Sourcepub fn get_stats(&self) -> Result<ThreadStats, Status>
pub fn get_stats(&self) -> Result<ThreadStats, Status>
Wraps the zx_object_get_info syscall for the ZX_INFO_THREAD_STATS topic.
pub fn read_state_general_regs( &self, ) -> Result<zx_thread_state_general_regs_t, Status>
pub fn write_state_general_regs( &self, state: zx_thread_state_general_regs_t, ) -> Result<(), Status>
Sourcepub fn raise_user_exception(
options: RaiseExceptionOptions,
synth_code: u32,
synth_data: u32,
) -> Result<(), Status>
pub fn raise_user_exception( options: RaiseExceptionOptions, synth_code: u32, synth_data: u32, ) -> Result<(), Status>
Wraps the zx_thread_raise_exception
syscall.
See https://fuchsia.dev/reference/syscalls/thread_raise_exception?hl=en for details.
Trait Implementations§
Source§impl AsHandleRef for Thread
impl AsHandleRef for Thread
Source§fn as_handle_ref(&self) -> Unowned<'_, Handle>
fn as_handle_ref(&self) -> Unowned<'_, Handle>
object_wait_many
.