exchange(with:)

Atomically exchanges value for the current value of this object.

NIOAtomic.swift:300

This declaration is deprecated: please use ManagedAtomic from https://github.com/apple/swift-atomics instead

func exchange(with value: T) -> T

Parameters

value

The new value to set this object to.

Returns

The value previously held by this object.

This implementation uses a relaxed memory ordering. This guarantees nothing more than that this operation is atomic: there is no guarantee that any other event will be ordered before or after this one.