|
Contiki-NG
|
This library provides an API and generic implementation of atomic operations. More...
Macros | |
| #define | atomic_cas_uint8(t, o, n) atomic_generic_cas_uint8((t),(o),(n)) |
| Atomic compare-and-swap (CAS) on a byte. More... | |
Functions | |
| bool | atomic_generic_cas_uint8 (uint8_t *target, uint8_t old_val, uint8_t new_val) |
| Atomic compare-and-swap (CAS) on a byte (generic impl.) More... | |
This library provides an API and generic implementation of atomic operations.
The structure of this library is more or less the same as sys/mutex. By default, atomic operations are implemented by disabling interrupts temporarily. Platforms can provide better implementation using platform-specific features.
| #define atomic_cas_uint8 | ( | t, | |
| o, | |||
| n | |||
| ) | atomic_generic_cas_uint8((t),(o),(n)) |
Atomic compare-and-swap (CAS) on a byte.
This macro expands to atomic_generic_cas_uint8() or CPU-provided implementation. Platform-independent code should use this macro instead of atomic_generic_cas_uint8().
| bool atomic_generic_cas_uint8 | ( | uint8_t * | target, |
| uint8_t | old_val, | ||
| uint8_t | new_val | ||
| ) |
Atomic compare-and-swap (CAS) on a byte (generic impl.)
| target | Pointer to the target byte to manipulate. |
| old_val | Value that is expected to be stored in the target. |
| new_val | Value that it stores to the target. |
If value of target is equal to old_val, store new_val to target. If the store operation succeeds, it returns true. Otherwise, it just returns false without storing.
1.8.13