Module thread
thread
OS thread creation and management with per-thread IO event loops.
Types
Thread
struct
Thread
OS thread handle. Each spawned thread gets its own IO event loop.
Fields
| Name | Type | Description |
|---|---|---|
handle | __yo_thread_t |
impl(Thread, ...)
spawn : (Thread) fn(cb : Impl(Fn(using(io : IO)) -> unit, Send)) -> Threadjoin : (Thread) fn(self : *(Thread)) -> unitBlock the current thread until this thread completes.
Parameters
| Name | Type | Notes |
|---|---|---|
self | *(Thread) |
Returns: unit
Functions
get_hardware_threads
function
fn() -> usize
Get the number of hardware threads (CPU cores) available.
Returns: usize
get_thread_id
function
fn() -> usize
Get the current OS thread ID.
Returns: usize
get_cpu_id
function
fn() -> i32
Get the current CPU core ID.
Returns: i32