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_thread_info(&self) -> Result<ThreadInfo, Status>
pub fn get_thread_info(&self) -> Result<ThreadInfo, Status>
Wraps the zx_object_get_info syscall for the ZX_INFO_THREAD 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
.Source§fn raw_handle(&self) -> u32
fn raw_handle(&self) -> u32
Source§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals,
) -> Result<(), Status>
fn signal_handle( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>
Source§fn wait_handle(
&self,
signals: Signals,
deadline: Instant<MonotonicTimeline>,
) -> WaitResult
fn wait_handle( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> WaitResult
Source§fn wait_async_handle(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts,
) -> Result<(), Status>
fn wait_async_handle( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>
Source§fn get_name(&self) -> Result<Name, Status>
fn get_name(&self) -> Result<Name, Status>
Source§fn set_name(&self, name: &Name) -> Result<(), Status>
fn set_name(&self, name: &Name) -> Result<(), Status>
Source§fn basic_info(&self) -> Result<HandleBasicInfo, Status>
fn basic_info(&self) -> Result<HandleBasicInfo, Status>
Source§fn count_info(&self) -> Result<HandleCountInfo, Status>
fn count_info(&self) -> Result<HandleCountInfo, Status>
§impl FromWire<WireHandle> for Thread
impl FromWire<WireHandle> for Thread
§fn from_wire(wire: WireHandle) -> Thread
fn from_wire(wire: WireHandle) -> Thread
wire
to this type.§const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _
const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _
§impl FromWireOption<WireOptionalHandle> for Thread
impl FromWireOption<WireOptionalHandle> for Thread
§fn from_wire_option(wire: WireOptionalHandle) -> Option<Thread>
fn from_wire_option(wire: WireOptionalHandle) -> Option<Thread>
wire
to an option of this type.Source§impl HandleBased for Thread
impl HandleBased for Thread
Source§fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
Source§fn replace_handle(self, rights: Rights) -> Result<Self, Status>
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
Source§fn into_handle(self) -> Handle
fn into_handle(self) -> Handle
Source§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
Source§fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
Source§fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn from_handle_based<H>(h: H) -> Selfwhere
H: HandleBased,
fn is_invalid_handle(&self) -> bool
Source§impl Ord for Thread
impl Ord for Thread
Source§impl PartialOrd for Thread
impl PartialOrd for Thread
Source§impl Task for Thread
impl Task for Thread
Source§fn create_exception_channel_with_opts(
&self,
opts: ExceptionChannelOptions,
) -> Result<Channel, Status>
fn create_exception_channel_with_opts( &self, opts: ExceptionChannelOptions, ) -> Result<Channel, Status>
Source§fn create_exception_channel(&self) -> Result<Channel, Status>
fn create_exception_channel(&self) -> Result<Channel, Status>
Source§fn get_runtime_info(&self) -> Result<TaskRuntimeInfo, Status>
fn get_runtime_info(&self) -> Result<TaskRuntimeInfo, Status>
impl Eq for Thread
impl StructuralPartialEq for Thread
Auto Trait Implementations§
impl Freeze for Thread
impl RefUnwindSafe for Thread
impl Send for Thread
impl Sync for Thread
impl Unpin for Thread
impl UnwindSafe for Thread
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> EncodableAsHandle for Twhere
T: HandleBased,
impl<T> EncodableAsHandle for Twhere
T: HandleBased,
Source§type Dialect = DefaultFuchsiaResourceDialect
type Dialect = DefaultFuchsiaResourceDialect
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T, W> FromWireOption<WireBox<'_, W>> for Twhere
T: FromWire<W>,
impl<T, W> FromWireOption<WireBox<'_, W>> for Twhere
T: FromWire<W>,
§fn from_wire_option(wire: WireBox<'_, W>) -> Option<T>
fn from_wire_option(wire: WireBox<'_, W>) -> Option<T>
wire
to an option of this type.