Import with #import "std/thread_windows".

ThreadProcedure :: #type (argument: *void)
WindowsThreadEntry :: #type (argument: *void) -> u32
ThreadNotification :: struct { procedure: ThreadProcedure; argument: *void; }
Thread :: struct { handle: usize; procedure: ThreadProcedure; argument: *void; notification: ThreadNotification; running: bool; finished: bool; }
ThreadRun :: (argument: *void) -> u32
ThreadStart :: (thread: *Thread, procedure: ThreadProcedure, argument: *void, notification: ThreadNotification) -> bool

The notification runs on this worker and must not join or restart it. _beginthreadex retains a waitable handle and releases C runtime thread storage when ThreadRun returns. The owner closes the handle after waiting.

ThreadRunning :: (thread: *Thread) -> bool
ThreadComplete :: (thread: *Thread, milliseconds: u32) -> bool
ThreadFinished :: (thread: *Thread) -> bool

A zero-time wait checks the actual native thread exit and never waits for its procedure, notification, or TLS cleanup. Successful polling consumes the handle once and makes the record reusable.

ThreadWait :: (thread: *Thread)

Source ↗ · All modules