nx_mutex_race_test.nx
buildroot/runtime/nx_mutex_race_test.nx
about
nx_mutex_race_test.nx -- prove the mutex provides REAL mutual
exclusion under multi-thread contention.
hw-derived (cpu_count * STRESS_FACTOR) worker threads each grab
the same mutex N times and bump a PLAIN (non-atomic) counter
inside the critical section. If the mutex doesn't actually
exclude, the non-atomic increment races and final counter < N
(lost updates). PASS criterion: final counter == n_threads * N
exactly.
dependencies 6 imports · 0 importers
imports: nx_kernel_v2.nxnx_log.nxnx_atom.nxnx_thread.nxnx_mutex.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
| 21 | struct SharedCounter |
consts
| 18 | const ITERATIONS_PER_THREAD: i64 = 5000 |
| 19 | const STRESS_FACTOR: i64 = 4 |
functions
| 27 | func worker_lock_bump(arg: *u8) -> i64 |
| 44 | func main() -> nx_exit |