Struct wasmer_wasix::os::task::thread::WasiThread
source · 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 new( pid: WasiProcessId, id: WasiThreadId, is_main: bool, status: Arc<OwnedTaskStatus>, guard: TaskCountGuard ) -> 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 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 more