Add missing retry to atomic exchange

Atomic exchange implementation forgot to do the retry if the exclusive
store failed.
pull/14001/head
Kevin Bracey 2020-12-03 16:23:33 +02:00
parent d2adc9ef78
commit 0b30742c80
1 changed files with 6 additions and 2 deletions

View File

@ -346,7 +346,9 @@ inline T core_util_atomic_exchange_##fn_suffix(volatile T *valuePtr, T newValue)
T oldValue; \
uint32_t fail; \
MBED_BARRIER(); \
DO_MBED_LOCKFREE_EXCHG_ASM(M); \
do { \
DO_MBED_LOCKFREE_EXCHG_ASM(M); \
} while (fail); \
MBED_BARRIER(); \
return oldValue; \
} \
@ -357,7 +359,9 @@ MBED_FORCEINLINE T core_util_atomic_exchange_explicit_##fn_suffix(
T oldValue; \
uint32_t fail; \
MBED_RELEASE_BARRIER(order); \
DO_MBED_LOCKFREE_EXCHG_ASM(M); \
do { \
DO_MBED_LOCKFREE_EXCHG_ASM(M); \
} while (fail); \
MBED_ACQUIRE_BARRIER(order); \
return oldValue; \
}