@@ -121,7 +121,7 @@ void core_util_critical_section_exit(void);
121
121
* }
122
122
*
123
123
* @note: In the failure case (where the destination isn't set), the value
124
- * pointed to by expectedCurrentValue is still updated with the current value.
124
+ * pointed to by expectedCurrentValue is instead updated with the current value.
125
125
* This property helps writing concise code for the following incr:
126
126
*
127
127
* function incr(p : pointer to int, a : int) returns int {
@@ -132,6 +132,10 @@ void core_util_critical_section_exit(void);
132
132
* }
133
133
* return value + a
134
134
* }
135
+ *
136
+ * @note: This corresponds to the C11 "atomic_compare_exchange_strong" - it
137
+ * always succeeds if the current value is expected, as per the pseudocode
138
+ * above; it will not spuriously fail as "atomic_compare_exchange_weak" may.
135
139
*/
136
140
bool core_util_atomic_cas_u8 (uint8_t * ptr , uint8_t * expectedCurrentValue , uint8_t desiredValue );
137
141
@@ -174,7 +178,7 @@ bool core_util_atomic_cas_u8(uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_
174
178
* }
175
179
*
176
180
* @note: In the failure case (where the destination isn't set), the value
177
- * pointed to by expectedCurrentValue is still updated with the current value.
181
+ * pointed to by expectedCurrentValue is instead updated with the current value.
178
182
* This property helps writing concise code for the following incr:
179
183
*
180
184
* function incr(p : pointer to int, a : int) returns int {
@@ -185,6 +189,10 @@ bool core_util_atomic_cas_u8(uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_
185
189
* }
186
190
* return value + a
187
191
* }
192
+ *
193
+ * @note: This corresponds to the C11 "atomic_compare_exchange_strong" - it
194
+ * always succeeds if the current value is expected, as per the pseudocode
195
+ * above; it will not spuriously fail as "atomic_compare_exchange_weak" may.
188
196
*/
189
197
bool core_util_atomic_cas_u16 (uint16_t * ptr , uint16_t * expectedCurrentValue , uint16_t desiredValue );
190
198
@@ -227,7 +235,7 @@ bool core_util_atomic_cas_u16(uint16_t *ptr, uint16_t *expectedCurrentValue, uin
227
235
* }
228
236
*
229
237
* @note: In the failure case (where the destination isn't set), the value
230
- * pointed to by expectedCurrentValue is still updated with the current value.
238
+ * pointed to by expectedCurrentValue is instead updated with the current value.
231
239
* This property helps writing concise code for the following incr:
232
240
*
233
241
* function incr(p : pointer to int, a : int) returns int {
@@ -237,6 +245,10 @@ bool core_util_atomic_cas_u16(uint16_t *ptr, uint16_t *expectedCurrentValue, uin
237
245
* done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
238
246
* }
239
247
* return value + a
248
+ *
249
+ * @note: This corresponds to the C11 "atomic_compare_exchange_strong" - it
250
+ * always succeeds if the current value is expected, as per the pseudocode
251
+ * above; it will not spuriously fail as "atomic_compare_exchange_weak" may.
240
252
* }
241
253
*/
242
254
bool core_util_atomic_cas_u32 (uint32_t * ptr , uint32_t * expectedCurrentValue , uint32_t desiredValue );
@@ -280,7 +292,7 @@ bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uin
280
292
* }
281
293
*
282
294
* @note: In the failure case (where the destination isn't set), the value
283
- * pointed to by expectedCurrentValue is still updated with the current value.
295
+ * pointed to by expectedCurrentValue is instead updated with the current value.
284
296
* This property helps writing concise code for the following incr:
285
297
*
286
298
* function incr(p : pointer to int, a : int) returns int {
@@ -291,6 +303,10 @@ bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uin
291
303
* }
292
304
* return value + a
293
305
* }
306
+ *
307
+ * @note: This corresponds to the C11 "atomic_compare_exchange_strong" - it
308
+ * always succeeds if the current value is expected, as per the pseudocode
309
+ * above; it will not spuriously fail as "atomic_compare_exchange_weak" may.
294
310
*/
295
311
bool core_util_atomic_cas_ptr (void * * ptr , void * * expectedCurrentValue , void * desiredValue );
296
312
0 commit comments