diff options
author | pjd <pjd@FreeBSD.org> | 2008-03-16 21:20:50 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2008-03-16 21:20:50 +0000 |
commit | ea49d310bf69a1de4effcf20fc368f40b3541ef0 (patch) | |
tree | ef1e5ab50a7584e0e028a94391bd41725fc82f82 /sys/ia64/include | |
parent | bc8c8477a02fa7911713785305f7fe01ee91f393 (diff) | |
download | FreeBSD-src-ea49d310bf69a1de4effcf20fc368f40b3541ef0.zip FreeBSD-src-ea49d310bf69a1de4effcf20fc368f40b3541ef0.tar.gz |
Implement atomic_fetchadd_long() for all architectures and document it.
Reviewed by: attilio, jhb, jeff, kris (as a part of the uidinfo_waitfree.patch)
Diffstat (limited to 'sys/ia64/include')
-rw-r--r-- | sys/ia64/include/atomic.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/ia64/include/atomic.h b/sys/ia64/include/atomic.h index 985f48f..fd90fa2 100644 --- a/sys/ia64/include/atomic.h +++ b/sys/ia64/include/atomic.h @@ -371,4 +371,15 @@ atomic_fetchadd_32(volatile uint32_t *p, uint32_t v) #define atomic_fetchadd_int atomic_fetchadd_32 +static __inline u_long +atomic_fetchadd_long(volatile u_long *p, u_long v) +{ + u_long value; + + do { + value = *p; + } while (!atomic_cmpset_64(p, value, value + v)); + return (value); +} + #endif /* ! _MACHINE_ATOMIC_H_ */ |