#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
|
int | lf_atomic_fetch_add (int *ptr, int val) |
| This file defines the LF atomic API. These functions will have platform-dependent implementations.
|
|
int64_t | lf_atomic_fetch_add64 (int64_t *ptr, int64_t val) |
| Atomically fetch 64-bit integer from memory and add a value to it. Return the value that was previously in memory.
|
|
int | lf_atomic_add_fetch (int *ptr, int val) |
| Atomically fetch an integer from memory and add a value to it. Return the new value of the memory.
|
|
int64_t | lf_atomic_add_fetch64 (int64_t *ptr, int64_t val) |
| Atomically fetch a 64-bit integer from memory and add a value to it. Return the new value of the memory.
|
|
bool | lf_atomic_bool_compare_and_swap (int *ptr, int oldval, int newval) |
| Atomically perform a compare-and-swap operation on a 32 bit integer in memory. If the value in memory is equal to oldval replace it with newval and return true. If not return false.
|
|
bool | lf_atomic_bool_compare_and_swap64 (int64_t *ptr, int64_t oldval, int64_t newval) |
| Atomically perform a compare-and-swap operation on a 64 bit integer in memory. If the value in memory is equal to oldval replace it with newval and return true. If not return false.
|
|
int | lf_atomic_val_compare_and_swap (int *ptr, int oldval, int newval) |
| Atomically perform a compare-and-swap operation on an integer in memory. If the value in memory is equal to oldval replace it with newval . Return the content of the memory before the potential swap operation is performed.
|
|
int64_t | lf_atomic_val_compare_and_swap64 (int64_t *ptr, int64_t oldval, int64_t newval) |
| Atomically perform a compare-and-swap operation on a 64 bit integer in memory. If the value in memory is equal to oldval replace it with newval . Return the content of the memory before the potential swap operation is performed.
|
|
◆ lf_atomic_add_fetch()
int lf_atomic_add_fetch |
( |
int * | ptr, |
|
|
int | val ) |
Atomically fetch an integer from memory and add a value to it. Return the new value of the memory.
- Parameters
-
ptr | A pointer to the memory location. |
val | The value to be added. |
- Returns
- The new value in memory.
◆ lf_atomic_add_fetch64()
int64_t lf_atomic_add_fetch64 |
( |
int64_t * | ptr, |
|
|
int64_t | val ) |
Atomically fetch a 64-bit integer from memory and add a value to it. Return the new value of the memory.
- Parameters
-
ptr | A pointer to the memory location. |
val | The value to be added. |
- Returns
- The new value in memory.
◆ lf_atomic_bool_compare_and_swap()
bool lf_atomic_bool_compare_and_swap |
( |
int * | ptr, |
|
|
int | oldval, |
|
|
int | newval ) |
Atomically perform a compare-and-swap operation on a 32 bit integer in memory. If the value in memory is equal to oldval
replace it with newval
and return true. If not return false.
- Parameters
-
ptr | A pointer to the memory location. |
oldval | The value to compare with. |
newval | The value to swap in. |
- Returns
- Whether a swap was performed or not.
◆ lf_atomic_bool_compare_and_swap64()
bool lf_atomic_bool_compare_and_swap64 |
( |
int64_t * | ptr, |
|
|
int64_t | oldval, |
|
|
int64_t | newval ) |
Atomically perform a compare-and-swap operation on a 64 bit integer in memory. If the value in memory is equal to oldval
replace it with newval
and return true. If not return false.
- Parameters
-
ptr | A pointer to the memory location. |
oldval | The value to compare with. |
newval | The value to swap in. |
- Returns
- Whether a swap was performed or not.
◆ lf_atomic_fetch_add()
int lf_atomic_fetch_add |
( |
int * | ptr, |
|
|
int | val ) |
This file defines the LF atomic API. These functions will have platform-dependent implementations.
- Author
- Erling Rennemo Jellum
- Copyright
- (c) 2023 License: BSD 2-clause
Atomically fetch an integer from memory and add a value to it. Return the value that was previously in memory.
- Parameters
-
ptr | A pointer to the memory location. |
val | The value to be added. |
- Returns
- The value previously in memory.
◆ lf_atomic_fetch_add64()
int64_t lf_atomic_fetch_add64 |
( |
int64_t * | ptr, |
|
|
int64_t | val ) |
Atomically fetch 64-bit integer from memory and add a value to it. Return the value that was previously in memory.
- Parameters
-
ptr | A pointer to the memory location. |
val | The value to be added. |
- Returns
- The value previously in memory.
◆ lf_atomic_val_compare_and_swap()
int lf_atomic_val_compare_and_swap |
( |
int * | ptr, |
|
|
int | oldval, |
|
|
int | newval ) |
Atomically perform a compare-and-swap operation on an integer in memory. If the value in memory is equal to oldval
replace it with newval
. Return the content of the memory before the potential swap operation is performed.
- Parameters
-
ptr | A pointer to the memory location. |
oldval | The value to compare with. |
newval | The value to swap in. |
- Returns
- The value in memory prior to the swap.
◆ lf_atomic_val_compare_and_swap64()
int64_t lf_atomic_val_compare_and_swap64 |
( |
int64_t * | ptr, |
|
|
int64_t | oldval, |
|
|
int64_t | newval ) |
Atomically perform a compare-and-swap operation on a 64 bit integer in memory. If the value in memory is equal to oldval
replace it with newval
. Return the content of the memory before the potential swap operation is performed.
- Parameters
-
ptr | A pointer to the memory location. |
oldval | The value to compare with. |
newval | The value to swap in. |
- Returns
- The value in memory prior to the swap.