59_atomic_cmpxchg_record.toy (209B)
1 fn __user_main(): i64 { 2 var x: i64 = 40; 3 let ok: bool = @atomic_cmpxchg<i64>(&x, 40, 42, .seq_cst, .relaxed, .strong).ok; 4 return x - ((ok as i64) - 1); 5 } 6 7 fn main(): i32 { return __user_main() as i32; }