feat: std.thread — Thread, Mutex/Cond, bounded worker Pool (PLAN-HTTPZ S6)
pthread bindings with darwin opaque sizes (mutex 64B, cond 48B; glibc divergence is a C3 per-OS item). Mutex/Cond initialize IN PLACE and Pool lives behind Pool.create's heap pointer — POSIX sync objects are address-sensitive, so nothing here moves after setup. Thread.spawn takes the C2 re-entry contract entry (callconv(.c), fabricates its own Context); Pool workers do exactly that with a per-worker malloc-backed GPA, then run default-conv tasks inside it. submit returns false on a full backlog (httpz thread_pool backpressure); shutdown finishes queued work and joins every worker. examples/1637 pins: 4 raw threads x 1000 locked increments, 100 pool tasks summing exactly once across 4 workers, a held worker + full backlog refusing the next submit, clean shutdown. JIT + AOT (AOT run three times). The std.sx barrel carries thread; .ir snapshot regen is the usual renumbering.
This commit is contained in:
4
examples/expected/1637-std-thread.stdout
Normal file
4
examples/expected/1637-std-thread.stdout
Normal file
@@ -0,0 +1,4 @@
|
||||
raw threads: 4 x 1000 locked increments = 4000
|
||||
pool: 100 tasks across 4 workers summed to 5050
|
||||
backpressure: full backlog refuses
|
||||
std.thread ok
|
||||
Reference in New Issue
Block a user