nx_thread_spawn_test.nx
buildroot/runtime/nx_thread_spawn_test.nx
about
nx_thread_spawn_test.nx -- end-to-end test for __thread_clone:
real OS thread spawn + atomic counter bumping + spin-join.
Strategy: parent allocates a shared counter (mmap'd page so child
sees the same memory), spawns a worker thread that bumps the
counter N times via atomic FAA, then spin-waits until the counter
hits N. No futex/condvar needed for this smoke -- just proves the
child trampoline works and that atomics propagate cross-thread.
Per cardinal end-to-end-or-dont-ship: this test EXERCISES the
trampoline rather than just compiling it. Runs under
qemu-riscv64-static which emulates clone() correctly.
dependencies 5 imports · 0 importers
imports: nx_kernel_v2.nxnx_log.nxnx_atom.nxnx_thread.nxnx_hw.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 20 | const ITERATIONS_PER_THREAD: i64 = 10000 |
| 27 | const STRESS_FACTOR: i64 = 4 |
functions
| 32 | func worker_bump(arg: *u8) -> i64 calls 1: nx_atom_faa_i64 |
| 42 | func main() -> nx_exit |