Struct wasmer_wasix::os::task::thread::WasiThread
source · pub struct WasiThread {
state: Arc<WasiThreadState>,
layout: WasiMemoryLayout,
start: ThreadStartType,
rewind: Option<RewindResult>,
}
Expand description
Represents a running thread which allows a joiner to wait for the thread to exit
Fields§
§state: Arc<WasiThreadState>
§layout: WasiMemoryLayout
§start: ThreadStartType
§rewind: Option<RewindResult>
Implementations§
source§impl WasiThread
impl WasiThread
pub fn id(&self) -> WasiThreadId
sourcepub(crate) fn set_rewind(&mut self, rewind: RewindResult)
pub(crate) fn set_rewind(&mut self, rewind: RewindResult)
Sets that a rewind will take place
sourcepub(crate) fn take_rewind(&mut self) -> Option<RewindResult>
pub(crate) fn take_rewind(&mut self) -> Option<RewindResult>
Pops any rewinds that need to take place
sourcepub fn thread_start_type(&self) -> ThreadStartType
pub fn thread_start_type(&self) -> ThreadStartType
Gets the thread start type for this thread
sourcepub(crate) fn has_rewind_of_type(&self, type_: HandleRewindType) -> bool
pub(crate) fn has_rewind_of_type(&self, type_: HandleRewindType) -> bool
Returns true if a rewind of a particular type has been queued for processed by a rewind operation
sourcepub(crate) fn set_deep_sleeping(&self, val: bool)
pub(crate) fn set_deep_sleeping(&self, val: bool)
Sets a flag that tells others if this thread is currently deep sleeping
sourcepub(crate) fn is_deep_sleeping(&self) -> bool
pub(crate) fn is_deep_sleeping(&self) -> bool
Reads a flag that determines if this thread is currently deep sleeping
sourcepub(crate) fn set_checkpointing(&self, val: bool)
pub(crate) fn set_checkpointing(&self, val: bool)
Sets a flag that tells others that this thread is currently check pointing itself
sourcepub(crate) fn is_check_pointing(&self) -> bool
pub(crate) fn is_check_pointing(&self) -> bool
Reads a flag that determines if this thread is currently check pointing itself or not
sourcepub(crate) fn memory_layout(&self) -> &WasiMemoryLayout
pub(crate) fn memory_layout(&self) -> &WasiMemoryLayout
Gets the memory layout for this thread
sourcepub(crate) fn set_memory_layout(&mut self, layout: WasiMemoryLayout)
pub(crate) fn set_memory_layout(&mut self, layout: WasiMemoryLayout)
Gets the memory layout 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§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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