Thread creation, management, and parallelism utilities.
All functions are backed by the Rust runtime.
A handle to a spawned thread.
struct Thread:
let id: Int = 0Spawns a new thread executing the given function. Returns a Thread handle.
Waits for the thread to finish execution.
Suspends the current thread for ms milliseconds.
Returns the number of logical CPUs available on the system.
load std.thread
fn worker() -> Void:
thread.sleep(100)
fn main() -> Int:
let t = thread.spawn(worker)
thread.thread_join(t)
let n = thread.available_parallelism()
return 0