Skip to main content

arm_fail_at

Function arm_fail_at 

Source
pub fn arm_fail_at(k: u32)
Available on crate feature fault-injection only.
Expand description

Arm the “fail the k-th real commit from now” hook (1-based, one-shot). The k-th call to the real commit path from now fails; calls already consumed by arm_fail_next are not counted. All other calls (before and after) succeed normally. After firing, the hook disarms itself. k == 0 disarms without ever firing.

Resets the internal call counter, so arming always counts from zero. Checked AFTER arm_fail_next’s hook. Inert under the aligned_vmem_mock cfg — see the module doc.

task #1021/R4-8: This function now uses a Mutex to serialize arming with the self-disarm in should_fail_commit, preventing the concurrent re-arm race where a re-arm between the target reset and counter reset would be lost. The earlier two-atomic approach (FAIL_AT_COUNTER = 0 then FAIL_AT_TARGET = k) had a race window between those stores.