diff options
author | Nick Piggin <nickpiggin@yahoo.com.au> | 2005-11-14 01:07:24 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-14 03:14:16 +0100 |
commit | 4a6dae6d382e9edf3ff440b819e554ed706359bc (patch) | |
tree | 2945a5095973e2ecf05b503d6deb859083045b8e /Documentation | |
parent | [PATCH] i386: generic cmpxchg (diff) | |
download | linux-4a6dae6d382e9edf3ff440b819e554ed706359bc.tar.xz linux-4a6dae6d382e9edf3ff440b819e554ed706359bc.zip |
[PATCH] atomic: cmpxchg
Introduce an atomic_cmpxchg operation.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/atomic_ops.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt index 8eedaa24f5e2..f1744161ef06 100644 --- a/Documentation/atomic_ops.txt +++ b/Documentation/atomic_ops.txt @@ -115,6 +115,21 @@ boolean is return which indicates whether the resulting counter value is negative. It requires explicit memory barrier semantics around the operation. +Finally: + + int atomic_cmpxchg(atomic_t *v, int old, int new); + +This performs an atomic compare exchange operation on the atomic value v, +with the given old and new values. Like all atomic_xxx operations, +atomic_cmpxchg will only satisfy its atomicity semantics as long as all +other accesses of *v are performed through atomic_xxx operations. + +atomic_cmpxchg requires explicit memory barriers around the operation. + +The semantics for atomic_cmpxchg are the same as those defined for 'cas' +below. + + If a caller requires memory barrier semantics around an atomic_t operation which does not return a value, a set of interfaces are defined which accomplish this: |