Argon RTOS
1.3.0
Tiny embedded real-time kernel
|
Atomic operation functions.
Atomic operations | |
int8_t | ar_atomic_add8 (volatile int8_t *value, int8_t delta) |
Atomic 8-bit add operation. More... | |
int16_t | ar_atomic_add16 (volatile int16_t *value, int16_t delta) |
Atomic 16-bit add operation. More... | |
int32_t | ar_atomic_add32 (volatile int32_t *value, int32_t delta) |
Atomic 32-bit add operation. More... | |
bool | ar_atomic_cas8 (volatile int8_t *value, int8_t expectedValue, int8_t newValue) |
Atomic 8-bit compare and swap operation. More... | |
bool | ar_atomic_cas16 (volatile int16_t *value, int16_t expectedValue, int16_t newValue) |
Atomic 16-bit compare and swap operation. More... | |
bool | ar_atomic_cas32 (volatile int32_t *value, int32_t expectedValue, int32_t newValue) |
Atomic 32-bit compare and swap operation. More... | |
int16_t ar_atomic_add16 | ( | volatile int16_t * | value, |
int16_t | delta | ||
) |
Atomic 16-bit add operation.
A memory barrier is performed prior to the add operation.
value | Pointer to the word to add to. |
delta | Signed value to atomically add to *value. |
int32_t ar_atomic_add32 | ( | volatile int32_t * | value, |
int32_t | delta | ||
) |
Atomic 32-bit add operation.
A memory barrier is performed prior to the add operation.
value | Pointer to the word to add to. |
delta | Signed value to atomically add to *value. |
int8_t ar_atomic_add8 | ( | volatile int8_t * | value, |
int8_t | delta | ||
) |
Atomic 8-bit add operation.
A memory barrier is performed prior to the add operation.
value | Pointer to the word to add to. |
delta | Signed value to atomically add to *value. |
bool ar_atomic_cas16 | ( | volatile int16_t * | value, |
int16_t | expectedValue, | ||
int16_t | newValue | ||
) |
Atomic 16-bit compare and swap operation.
Tests the word pointed to by value for equality with expectedValue. If they are equal, the word pointed to by value is set to newValue. If *value is not equal to expectedValue, then no change is made. The return value indicates whether the swap was performed. Of course, this entire operation is guaranteed to be atomic even on multiprocessor platforms.
A memory barrier is performed prior to the compare and swap operation.
value | Pointer to the word to compare and swap. |
expectedValue | Value to compare against. |
newValue | Value to value to swap in if *value is equal to expectedValue. |
false | No change was made to *value. |
true | The swap was performed, and *value is now equal to newValue. |
bool ar_atomic_cas32 | ( | volatile int32_t * | value, |
int32_t | expectedValue, | ||
int32_t | newValue | ||
) |
Atomic 32-bit compare and swap operation.
Tests the word pointed to by value for equality with expectedValue. If they are equal, the word pointed to by value is set to newValue. If *value is not equal to expectedValue, then no change is made. The return value indicates whether the swap was performed. Of course, this entire operation is guaranteed to be atomic even on multiprocessor platforms.
A memory barrier is performed prior to the compare and swap operation.
value | Pointer to the word to compare and swap. |
expectedValue | Value to compare against. |
newValue | Value to value to swap in if *value is equal to expectedValue. |
false | No change was made to *value. |
true | The swap was performed, and *value is now equal to newValue. |
bool ar_atomic_cas8 | ( | volatile int8_t * | value, |
int8_t | expectedValue, | ||
int8_t | newValue | ||
) |
Atomic 8-bit compare and swap operation.
Tests the word pointed to by value for equality with expectedValue. If they are equal, the word pointed to by value is set to newValue. If *value is not equal to expectedValue, then no change is made. The return value indicates whether the swap was performed. Of course, this entire operation is guaranteed to be atomic even on multiprocessor platforms.
A memory barrier is performed prior to the compare and swap operation.
value | Pointer to the word to compare and swap. |
expectedValue | Value to compare against. |
newValue | Value to value to swap in if *value is equal to expectedValue. |
false | No change was made to *value. |
true | The swap was performed, and *value is now equal to newValue. |