pub struct WasiThread { /* private fields */ }
Expand description
Represents a running thread which allows a joiner to wait for the thread to exit
Implementations§
Source§impl WasiThread
impl WasiThread
pub fn id(&self) -> WasiThreadId
Sourcepub fn thread_start_type(&self) -> ThreadStartType
pub fn thread_start_type(&self) -> ThreadStartType
Gets the thread start type for this thread
Source§impl WasiThread
impl WasiThread
pub fn new( pid: WasiProcessId, id: WasiThreadId, is_main: bool, status: Arc<OwnedTaskStatus>, guard: TaskCountGuard, layout: WasiMemoryLayout, start: ThreadStartType, ) -> Self
Sourcepub fn pid(&self) -> WasiProcessId
pub fn pid(&self) -> WasiProcessId
Returns the process ID
Sourcepub fn tid(&self) -> WasiThreadId
pub fn tid(&self) -> WasiThreadId
Returns the thread ID
Sourcepub fn join_handle(&self) -> TaskJoinHandle
pub fn join_handle(&self) -> TaskJoinHandle
Get a join handle to watch the task status.
pub fn signals(&self) -> &Mutex<(Vec<Signal>, Vec<Waker>)>
pub fn set_status_running(&self)
Sourcepub fn set_or_get_exit_code_for_signal(&self, sig: Signal) -> ExitCode
pub fn set_or_get_exit_code_for_signal(&self, sig: Signal) -> ExitCode
Gets or sets the exit code based of a signal that was received Note: if the exit code was already set earlier this method will just return that earlier set exit code
Sourcepub fn set_status_finished(&self, res: Result<ExitCode, WasiRuntimeError>)
pub fn set_status_finished(&self, res: Result<ExitCode, WasiRuntimeError>)
Marks the thread as finished (which will cause anyone that joined on it to wake up)
Sourcepub async fn join(&self) -> Result<ExitCode, Arc<WasiRuntimeError>>
pub async fn join(&self) -> Result<ExitCode, Arc<WasiRuntimeError>>
Waits until the thread is finished or the timeout is reached
Sourcepub fn try_join(&self) -> Option<Result<ExitCode, Arc<WasiRuntimeError>>>
pub fn try_join(&self) -> Option<Result<ExitCode, Arc<WasiRuntimeError>>>
Attempts to join on the thread
Sourcepub fn has_signal(&self, signals: &[Signal]) -> bool
pub fn has_signal(&self, signals: &[Signal]) -> bool
Returns all the signals that are waiting to be processed
Sourcepub async fn wait_for_signal(&self)
pub async fn wait_for_signal(&self)
Waits for a signal to arrive
Sourcepub fn pop_signals_or_subscribe(&self, waker: &Waker) -> Option<Vec<Signal>>
pub fn pop_signals_or_subscribe(&self, waker: &Waker) -> Option<Vec<Signal>>
Returns all the signals that are waiting to be processed
Sourcepub fn has_signals_or_subscribe(&self, waker: &Waker) -> bool
pub fn has_signals_or_subscribe(&self, waker: &Waker) -> bool
Returns all the signals that are waiting to be processed
Sourcepub fn pop_signals(&self) -> Vec<Signal>
pub fn pop_signals(&self) -> Vec<Signal>
Returns all the signals that are waiting to be processed
Sourcepub fn add_snapshot(
&self,
memory_stack: &[u8],
memory_stack_corrected: &[u8],
hash: u128,
rewind_stack: &[u8],
store_data: &[u8],
)
pub fn add_snapshot( &self, memory_stack: &[u8], memory_stack_corrected: &[u8], hash: u128, rewind_stack: &[u8], store_data: &[u8], )
Adds a stack snapshot and removes dead ones
Sourcepub fn get_snapshot(&self, hash: u128) -> Option<(BytesMut, Bytes, Bytes)>
pub fn get_snapshot(&self, hash: u128) -> Option<(BytesMut, Bytes, Bytes)>
Gets a snapshot that was previously addedf
pub fn copy_stack_from(&self, other: &WasiThread)
Trait Implementations§
Source§impl Clone for WasiThread
impl Clone for WasiThread
Source§fn clone(&self) -> WasiThread
fn clone(&self) -> WasiThread
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl !Freeze for WasiThread
impl !RefUnwindSafe for WasiThread
impl Send for WasiThread
impl Sync for WasiThread
impl Unpin for WasiThread
impl !UnwindSafe for WasiThread
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more