Raw operating-system-thread wrapper with explicit creation, handle-state checks, and completion waiting. The wrapper owns one operating-system thread handle and returns one Nat32 exit code from wait.
Thread
Methods
create
(code context stackSize --) Starts one thread from one entry-code pointer, one context value, and one explicit stack size in bytes.Preconditions
- The wrapper is not already running.
Postconditions
- The wrapper becomes handle-owning.
Helper constructor
Lifecycle and exit codes
Examples
Windows thread example
"String" use
"control.Int32" use
"control.Nat32" use
"control.Natx" use
"control.drop" use
"conventions.stdcall" use
"windows/Thread" use
worker: {parameter: Natx;} Nat32 {convention: stdcall;} codeRef; [
drop
7n32
] !worker
{} Int32 {} [
thread: @worker 0nx 0n32 toThread3;
result: @thread.wait;
("result=" result LF) printList
0
] "main" exportFunction
Expected Output
result=7
See also
- sync/sync: Cross-platform scheduling, sleep, time, IPv4 formatting, and TCP helpers.
- sync/Context: Spawned context handle with waiting, output retrieval, and cancellation.
- sync/ContextGroup: Group of spawned contexts with shared waiting and cancellation.
- windows/hardwareConcurrency: Processor-count query helper.