Skip to content

Commit 0ca2056

Browse files
committed
Document unstable::atomics fetch_* return values
1 parent d809f54 commit 0ca2056

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libstd/unstable/atomics.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,13 @@ impl AtomicInt {
155155
unsafe { atomic_compare_and_swap(&mut self.v, old, new, order) }
156156
}
157157

158+
/// Returns the old value (like __sync_fetch_and_add).
158159
#[inline(always)]
159160
pub fn fetch_add(&mut self, val: int, order: Ordering) -> int {
160161
unsafe { atomic_add(&mut self.v, val, order) }
161162
}
162163

164+
/// Returns the old value (like __sync_fetch_and_sub).
163165
#[inline(always)]
164166
pub fn fetch_sub(&mut self, val: int, order: Ordering) -> int {
165167
unsafe { atomic_sub(&mut self.v, val, order) }
@@ -191,11 +193,13 @@ impl AtomicUint {
191193
unsafe { atomic_compare_and_swap(&mut self.v, old, new, order) }
192194
}
193195

196+
/// Returns the old value (like __sync_fetch_and_add).
194197
#[inline(always)]
195198
pub fn fetch_add(&mut self, val: uint, order: Ordering) -> uint {
196199
unsafe { atomic_add(&mut self.v, val, order) }
197200
}
198201

202+
/// Returns the old value (like __sync_fetch_and_sub)..
199203
#[inline(always)]
200204
pub fn fetch_sub(&mut self, val: uint, order: Ordering) -> uint {
201205
unsafe { atomic_sub(&mut self.v, val, order) }
@@ -315,6 +319,7 @@ pub unsafe fn atomic_swap<T>(dst: &mut T, val: T, order: Ordering) -> T {
315319
})
316320
}
317321

322+
/// Returns the old value (like __sync_fetch_and_add).
318323
#[inline(always)]
319324
pub unsafe fn atomic_add<T>(dst: &mut T, val: T, order: Ordering) -> T {
320325
let dst = cast::transmute(dst);
@@ -327,6 +332,7 @@ pub unsafe fn atomic_add<T>(dst: &mut T, val: T, order: Ordering) -> T {
327332
})
328333
}
329334

335+
/// Returns the old value (like __sync_fetch_and_sub).
330336
#[inline(always)]
331337
pub unsafe fn atomic_sub<T>(dst: &mut T, val: T, order: Ordering) -> T {
332338
let dst = cast::transmute(dst);

0 commit comments

Comments
 (0)