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} {
163
163
/// overflow does occur. In `-Ounchecked` builds, overflow checking is not
164
164
/// performed.
165
165
///
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
+ ///
166
171
/// - Parameter operand: An integer value.
167
172
/// - Parameter ordering: The memory ordering to apply on this operation.
168
173
/// - Returns: A tuple containing the original value before the operation and
@@ -202,6 +207,11 @@ extension Atomic where Value == ${intType} {
202
207
/// overflow does occur. In `-Ounchecked` builds, overflow checking is not
203
208
/// performed.
204
209
///
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
+ ///
205
215
/// - Parameter operand: An integer value.
206
216
/// - Parameter ordering: The memory ordering to apply on this operation.
207
217
/// - Returns: A tuple containing the original value before the operation and
You can’t perform that action at this time.
0 commit comments