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:
@@ -1430,6 +1430,90 @@ declare void @Server.write_more(ptr, ptr, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare void @Server.respond_error_close(ptr, ptr, i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_create(ptr, ptr, ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_join(i64, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_detach(i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_mutex_init(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_mutex_lock(ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_mutex_unlock(ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_mutex_destroy(ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_cond_init(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_cond_wait(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_cond_signal(ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_cond_broadcast(ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @pthread_cond_destroy(ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @Mutex.setup(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Mutex.lock(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Mutex.unlock(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Mutex.destroy(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @Cond.setup(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Cond.wait(ptr, ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Cond.signal(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Cond.broadcast(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Cond.destroy(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare [2 x i64] @Thread.spawn(ptr, ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Thread.join(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Thread.detach(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare [2 x i64] @Pool.create(ptr, i64, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i1 @Pool.submit(ptr, ptr, ptr, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Pool.shutdown(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare ptr @pool_worker(ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @BuildOptions.add_link_flag.77(i64, ptr) #0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user