danos/library/runtime
Daniel Samson b3a8147bd7 threads(M4): futex_wait/futex_wake, the blocking primitive
New private syscalls futex_wait(addr, expected, timeout_ns)=40 and
futex_wake(addr, count)=41. A waiter is a .blocked task tagged with
Task.futex_addr (no queue linkage); futex_wait reads the user word under the big
lock and parks only if it still equals expected, so a concurrent wake can't slip
between the check and the block. futex_wake scans the task table and readies up
to count waiters in the same address space. A timed wait also sets wake_at so the
existing wakeExpired times it out; futex_addr staying non-zero (only futex_wake
clears it) distinguishes timeout from a real wake. Waiters park in-kernel, so an
idle core still halts (no busy-wait).

runtime.Thread.Futex mirrors std.Thread.Futex (wait/timedWait/wake). thread-test
gains a futex mode: a waiter parks, the main thread wakes it (serial order
waiting/waking/woke, asserted by the case regex), and timedWait reports a
timeout.

Gate thread-futex PASS (3x); 18 guardrail cases green incl. sleep/event/ipc
blocking paths; build + host tests clean.
2026-07-20 21:30:57 +01:00
..
block.zig fat/usb-storage: flush the device cache on close so writes survive power-off 2026-07-13 23:29:15 +01:00
device.zig WIP: USB 2026-07-12 22:24:47 +01:00
display.zig display: runtime mode-setting, EDID, and fenced (vsync) present (v2 V5) 2026-07-14 12:44:21 +01:00
dma.zig M14b: DMA memory (dma_alloc / dma_free) 2026-07-10 19:43:59 +01:00
fs.zig Phase 2d (ii): filesystem modification time (mtime) 2026-07-13 20:43:40 +01:00
heap.zig Split the `system` contract into boot-handoff / abi / device-abi 2026-07-10 18:08:51 +01:00
input.zig fixing comments 2026-07-12 16:19:09 +01:00
ipc.zig Signals over IPC, one-shot timers, and the service harness (M17.4) 2026-07-12 23:53:38 +01:00
process.zig Signals over IPC, one-shot timers, and the service harness (M17.4) 2026-07-12 23:53:38 +01:00
root.zig removing the need for panic and _start snippets in user space binaries 2026-07-17 16:15:30 +01:00
runtime.zig threads(M2): thread_spawn/thread_exit + runtime.Thread.spawn 2026-07-20 21:04:23 +01:00
service.zig The application surface: enumerate, subscribe, and device-list (M18.3) 2026-07-13 00:49:03 +01:00
shm.zig display: hot-attach a virtio-gpu native backend over the GOP floor (v2 V4) 2026-07-14 12:21:37 +01:00
start.zig removing the need for panic and _start snippets in user space binaries 2026-07-17 16:15:30 +01:00
system-call.zig zig fmt 2026-07-12 16:04:58 +01:00
system.zig Phase 2d (i): a kernel wall-clock from the CMOS RTC 2026-07-13 20:35:03 +01:00
thread.zig threads(M4): futex_wait/futex_wake, the blocking primitive 2026-07-20 21:30:57 +01:00
time.zig Add runtime.time, drop demo drivers, harden TSC timekeeping 2026-07-13 11:56:43 +01:00
usb.zig USB driver stack: xHCI transfers, HID keyboard/mouse, mass storage 2026-07-13 14:11:00 +01:00
user.ld Re-organize the source tree as a monorepo mirroring the FHS 2026-07-10 12:55:56 +01:00