Skip to main content

VirtualThread

Trait VirtualThread 

Source
pub trait VirtualThread<ThreadAccessor: ThreadAccess> {
    // Required method
    fn new_thread(
        &self,
        accessor: ThreadAccessor,
        runner: ThreadRunner,
    ) -> Option<NonZero<u32>>;

    // Provided method
    fn sched_yield<Wasm: WasmAccess + WasmAccessName + 'static>(&self) -> Errno { ... }
}
Expand description

Trait for a virtual thread implementation.

Required Methods§

Source

fn new_thread( &self, accessor: ThreadAccessor, runner: ThreadRunner, ) -> Option<NonZero<u32>>

Creates a new thread and returns its ID.

Provided Methods§

Source

fn sched_yield<Wasm: WasmAccess + WasmAccessName + 'static>(&self) -> Errno

Yields the execution of the current thread.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<ThreadAccessor: ThreadAccess, Generator: ThreadIdGenerator> VirtualThread<ThreadAccessor> for VirtualThreadPool<ThreadAccessor, Generator>

Source§

impl<ThreadAccessor: ThreadAccess> VirtualThread<ThreadAccessor> for DirectThreadPool<ThreadAccessor>