Problem
packages/async is not in build.zig and cannot compile on current Zig (std.Thread.Mutex / std.Thread.Condition are gone). The executor also has real concurrency bugs: TaskQueue.init returns an error from a function that can't fail; many threads push into a global queue that is only safe for its owner; grow() frees the buffer while other workers may still read it; worker 0 runs on two threads at once; deinit never wakes parked workers and can hang. scheduler and events use the same removed APIs.
Evidence (origin/main @ d4b219507)
packages/async/src/executor.zig:40-45packages/async/src/executor.zig:70packages/async/src/executor.zig:81-85packages/async/src/executor.zig:169packages/async/src/channel.zig:43packages/async/src/concurrency.zig:10packages/scheduler/src/scheduler.zig:270packages/scheduler/src/scheduler.zig:463packages/events/src/events.zig:33packages/events/src/events.zig:226
Scope
- Wire
async,scheduler,eventsintobuild.zigandzig build test. - Port them to the futex primitives.
- Fix the deque (Chase-Lev with epoch/hazard reclamation or never-free growth), the global injector queue, worker-0 double scheduling and shutdown.
Acceptance criteria
zig build testcovers async/scheduler/events.- A test running 1M tasks across all cores completes cleanly under TSan, repeated 100×.