File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
stdlib/public/Synchronization/Atomics Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,11 @@ extension Atomic where Value == ${intType} {
163163 /// overflow does occur. In `-Ounchecked` builds, overflow checking is not
164164 /// performed.
165165 ///
166+ /// The need to check for overflow means that this operation is typically
167+ /// compiled into a compare-exchange loop. For use cases that require a
168+ /// direct atomic addition, see the `wrappingAdd` operation: it avoids the
169+ /// loop, but in exchange it allows silent wraps on overflow.
170+ ///
166171 /// - Parameter operand: An integer value.
167172 /// - Parameter ordering: The memory ordering to apply on this operation.
168173 /// - Returns: A tuple containing the original value before the operation and
@@ -202,6 +207,11 @@ extension Atomic where Value == ${intType} {
202207 /// overflow does occur. In `-Ounchecked` builds, overflow checking is not
203208 /// performed.
204209 ///
210+ /// The need to check for overflow means that this operation is typically
211+ /// compiled into a compare-exchange loop. For use cases that require a
212+ /// direct atomic subtraction, see the `wrappingSubtract` operation: it
213+ /// avoids the loop, but in exchange it allows silent wraps on overflow.
214+ ///
205215 /// - Parameter operand: An integer value.
206216 /// - Parameter ordering: The memory ordering to apply on this operation.
207217 /// - Returns: A tuple containing the original value before the operation and
You can’t perform that action at this time.
0 commit comments