@atomicRmw

@atomicRmw

@atomicRmw(comptime T: type, ptr: *T, comptime op: AtomicRmwOp, operand: T, comptime ordering: AtomicOrder) T

This builtin function dereferences a pointer to a T and atomically modifies the value and returns the previous value.

T must be a pointer, a bool, a float, an integer or an enum.

AtomicOrder can be found with @import("std").builtin.AtomicOrder.

AtomicRmwOp can be found with @import("std").builtin.AtomicRmwOp.

See also:

  • @atomicStore
  • @atomicLoad
  • @fence
  • @cmpxchgWeak
  • @cmpxchgStrong