diff --git a/std/atomic/int.zig b/std/atomic/int.zig index 38b85873c0..94985b914f 100644 --- a/std/atomic/int.zig +++ b/std/atomic/int.zig @@ -26,6 +26,10 @@ pub fn Int(comptime T: type) type { return @atomicLoad(T, &self.unprotected_value, AtomicOrder.SeqCst); } + pub fn set(self: *Self, new_value: T) void { + _ = self.xchg(new_value); + } + pub fn xchg(self: *Self, new_value: T) T { return @atomicRmw(T, &self.unprotected_value, builtin.AtomicRmwOp.Xchg, new_value, AtomicOrder.SeqCst); }