Skip to content

Latest commit

 

History

History
57 lines (35 loc) · 1.13 KB

atomic_exchange.adoc

File metadata and controls

57 lines (35 loc) · 1.13 KB

atomic_exchange, atomic_exchange_explicit

Atomically replace the value pointed to by object with desired.

C atomic_exchange(volatile A *object,
                  C desired)

C atomic_exchange_explicit(volatile A *object,
                           C desired,
                           memory_order order)

C atomic_exchange_explicit(volatile A *object,
                           C desired,
                           memory_order order,
                           memory_scope scope)

Parameters

object
desired
order
scope

== Description

Atomically replace the value pointed to by object with desired. Memory is affected according to the value of order. These operations are read-modify-write operations (as defined by section 5.1.2.4 of the C11 specification). Atomically returns the value pointed to by object immediately before the effects.