compare-and-swap

Also known as: CAS, compare and swap, compare_exchange

Compare-and-swap is an atomic operation that updates a memory location only if it still holds an expected value, a building block of lock-free code.

See the standard library documentation.