diff options
Diffstat (limited to 'Documentation/atomic_ops.txt')
-rw-r--r-- | Documentation/atomic_ops.txt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt index 8eedaa24f5e2..23a1c2402bcc 100644 --- a/Documentation/atomic_ops.txt +++ b/Documentation/atomic_ops.txt | |||
@@ -115,6 +115,33 @@ boolean is return which indicates whether the resulting counter value | |||
115 | is negative. It requires explicit memory barrier semantics around the | 115 | is negative. It requires explicit memory barrier semantics around the |
116 | operation. | 116 | operation. |
117 | 117 | ||
118 | Then: | ||
119 | |||
120 | int atomic_cmpxchg(atomic_t *v, int old, int new); | ||
121 | |||
122 | This performs an atomic compare exchange operation on the atomic value v, | ||
123 | with the given old and new values. Like all atomic_xxx operations, | ||
124 | atomic_cmpxchg will only satisfy its atomicity semantics as long as all | ||
125 | other accesses of *v are performed through atomic_xxx operations. | ||
126 | |||
127 | atomic_cmpxchg requires explicit memory barriers around the operation. | ||
128 | |||
129 | The semantics for atomic_cmpxchg are the same as those defined for 'cas' | ||
130 | below. | ||
131 | |||
132 | Finally: | ||
133 | |||
134 | int atomic_add_unless(atomic_t *v, int a, int u); | ||
135 | |||
136 | If the atomic value v is not equal to u, this function adds a to v, and | ||
137 | returns non zero. If v is equal to u then it returns zero. This is done as | ||
138 | an atomic operation. | ||
139 | |||
140 | atomic_add_unless requires explicit memory barriers around the operation. | ||
141 | |||
142 | atomic_inc_not_zero, equivalent to atomic_add_unless(v, 1, 0) | ||
143 | |||
144 | |||
118 | If a caller requires memory barrier semantics around an atomic_t | 145 | If a caller requires memory barrier semantics around an atomic_t |
119 | operation which does not return a value, a set of interfaces are | 146 | operation which does not return a value, a set of interfaces are |
120 | defined which accomplish this: | 147 | defined which accomplish this: |