Import with #import "std/thread_linux".
ThreadProcedure :: #type (argument: *void)PosixThreadEntry :: #type (argument: *void) -> *voidThreadJoinable :: (thread: *Thread) -> boolThreadNotification :: struct { procedure: ThreadProcedure; argument: *void; }Thread :: struct { handle: usize; lock: [8]u64; procedure: ThreadProcedure; argument: *void; notification: ThreadNotification; running: bool; finished: bool; returned: bool; }ThreadLock :: (thread: *Thread) -> *voidThreadRun :: (argument: *void) -> *voidThreadStart :: (thread: *Thread, procedure: ThreadProcedure, argument: *void, notification: ThreadNotification) -> boolStarts `procedure(argument)` on a new thread. Returns false when the record is still running something or no thread could be started. `notification.procedure(notification.argument)` runs once after completion is published, so an event loop can wake without polling. It must not join or restart this Thread. Both arguments must live until the owner joins it.
ThreadRunning :: (thread: *Thread) -> boolWhether the record is running a procedure that has not been reported finished yet.
ThreadFinished :: (thread: *Thread) -> boolWhether the procedure started on `thread` has finished. Never waits; the first time it reports true the thread is joined and the record is free.
ThreadWait :: (thread: *Thread)Waits until the procedure started on `thread` has finished.