Struct Thread
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§
§impl Thread
impl Thread
pub 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.
pub 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.
pub 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.
pub 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.
pub 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.
pub 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>
pub 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§
§impl AsHandleRef for Thread
impl AsHandleRef for Thread
§fn as_handle_ref(&self) -> Unowned<'_, Handle>
fn as_handle_ref(&self) -> Unowned<'_, Handle>
object_wait_many
.§fn raw_handle(&self) -> u32
fn raw_handle(&self) -> u32
§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals,
) -> Result<(), Status>
fn signal_handle( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>
§fn wait_handle(
&self,
signals: Signals,
deadline: Instant<MonotonicTimeline>,
) -> WaitResult
fn wait_handle( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> WaitResult
§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>
§fn get_name(&self) -> Result<Name, Status>
fn get_name(&self) -> Result<Name, Status>
§fn set_name(&self, name: &Name) -> Result<(), Status>
fn set_name(&self, name: &Name) -> Result<(), Status>
§fn basic_info(&self) -> Result<HandleBasicInfo, Status>
fn basic_info(&self) -> Result<HandleBasicInfo, Status>
§fn count_info(&self) -> Result<HandleCountInfo, Status>
fn count_info(&self) -> Result<HandleCountInfo, Status>
Source§impl CompatFrom<Thread> for Thread
impl CompatFrom<Thread> for Thread
Source§fn compat_from(value: Thread) -> Thread
fn compat_from(value: Thread) -> Thread
value
into a value of this type.Source§impl Encodable for Thread
impl Encodable for Thread
Source§type Encoded = WireThread
type Encoded = WireThread
Source§const COPY_OPTIMIZATION: CopyOptimization<Self, Self::Encoded> = _
const COPY_OPTIMIZATION: CopyOptimization<Self, Self::Encoded> = _
Self
to Self::Encoded
is equivalent to copying the raw bytes
of Self
. Read moreSource§impl EncodableOption for Thread
impl EncodableOption for Thread
Source§type EncodedOption = WireOptionalThread
type EncodedOption = WireOptionalThread
Source§impl<E> EncodeOption<E> for Threadwhere
E: HandleEncoder + ?Sized,
impl<E> EncodeOption<E> for Threadwhere
E: HandleEncoder + ?Sized,
Source§fn encode_option(
this: Option<Thread>,
encoder: &mut E,
out: &mut MaybeUninit<<Thread as EncodableOption>::EncodedOption>,
) -> Result<(), EncodeError>
fn encode_option( this: Option<Thread>, encoder: &mut E, out: &mut MaybeUninit<<Thread as EncodableOption>::EncodedOption>, ) -> Result<(), EncodeError>
Source§impl FromWire<WireThread> for Thread
impl FromWire<WireThread> for Thread
Source§fn from_wire(wire: WireThread) -> Thread
fn from_wire(wire: WireThread) -> Thread
wire
to this type.Source§const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _
const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _
Source§impl FromWireOption<WireOptionalThread> for Thread
impl FromWireOption<WireOptionalThread> for Thread
Source§fn from_wire_option(wire: WireOptionalThread) -> Option<Thread>
fn from_wire_option(wire: WireOptionalThread) -> Option<Thread>
wire
to an option of this type.§impl HandleBased for Thread
impl HandleBased for Thread
§fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
§fn replace_handle(self, rights: Rights) -> Result<Self, Status>
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
§fn into_handle(self) -> Handle
fn into_handle(self) -> Handle
§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
§fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
fn into_handle_based<H>(self) -> Hwhere
H: HandleBased,
§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
§impl Ord for Thread
impl Ord for Thread
§impl PartialOrd for Thread
impl PartialOrd for Thread
§impl Task for Thread
impl Task for Thread
§fn create_exception_channel_with_opts(
&self,
opts: ExceptionChannelOptions,
) -> Result<Channel, Status>
fn create_exception_channel_with_opts( &self, opts: ExceptionChannelOptions, ) -> Result<Channel, Status>
§fn create_exception_channel(&self) -> Result<Channel, Status>
fn create_exception_channel(&self) -> Result<Channel, Status>
§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
§impl<T> EncodableAsHandle for Twhere
T: HandleBased,
impl<T> EncodableAsHandle for Twhere
T: HandleBased,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T, W> FromWireOption<WireBox<'_, W>> for Twhere
T: FromWire<W>,
impl<T, W> FromWireOption<WireBox<'_, W>> for Twhere
T: FromWire<W>,
Source§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.