EPICS Base
7.0.8.1
|
OS independent interface to perform atomic operations. More...
#include <stdlib.h>
#include "compilerSpecific.h"
#include "epicsAtomicCD.h"
Go to the source code of this file.
Macros | |
#define | EPICS_ATOMIC_INLINE static EPICS_ALWAYS_INLINE |
Typedefs | |
typedef void * | EpicsAtomicPtrT |
Functions | |
EPICS_ATOMIC_INLINE void | epicsAtomicReadMemoryBarrier (void) |
load target into cache More... | |
EPICS_ATOMIC_INLINE void | epicsAtomicWriteMemoryBarrier (void) |
push cache version of target into target More... | |
EPICS_ATOMIC_INLINE size_t | epicsAtomicIncrSizeT (size_t *pTarget) |
atomic increment on size_t value More... | |
EPICS_ATOMIC_INLINE int | epicsAtomicIncrIntT (int *pTarget) |
atomic increment on int value More... | |
EPICS_ATOMIC_INLINE size_t | epicsAtomicDecrSizeT (size_t *pTarget) |
atomic decrement on size_t value More... | |
EPICS_ATOMIC_INLINE int | epicsAtomicDecrIntT (int *pTarget) |
atomic decrement on int value More... | |
EPICS_ATOMIC_INLINE size_t | epicsAtomicAddSizeT (size_t *pTarget, size_t delta) |
atomic addition on size_t value More... | |
EPICS_ATOMIC_INLINE size_t | epicsAtomicSubSizeT (size_t *pTarget, size_t delta) |
atomic subtraction on size_t value More... | |
EPICS_ATOMIC_INLINE int | epicsAtomicAddIntT (int *pTarget, int delta) |
atomic addition on int value More... | |
EPICS_ATOMIC_INLINE void | epicsAtomicSetSizeT (size_t *pTarget, size_t newValue) |
atomically assign size_t value to variable More... | |
EPICS_ATOMIC_INLINE void | epicsAtomicSetIntT (int *pTarget, int newValue) |
atomically assign int value to variable More... | |
EPICS_ATOMIC_INLINE void | epicsAtomicSetPtrT (EpicsAtomicPtrT *pTarget, EpicsAtomicPtrT newValue) |
atomically assign pointer value to variable More... | |
EPICS_ATOMIC_INLINE size_t | epicsAtomicGetSizeT (const size_t *pTarget) |
atomically load and return size_t value More... | |
EPICS_ATOMIC_INLINE int | epicsAtomicGetIntT (const int *pTarget) |
atomically load and return int value More... | |
EPICS_ATOMIC_INLINE EpicsAtomicPtrT | epicsAtomicGetPtrT (const EpicsAtomicPtrT *pTarget) |
atomically load and return pointer value More... | |
EPICS_ATOMIC_INLINE size_t | epicsAtomicCmpAndSwapSizeT (size_t *pTarget, size_t oldVal, size_t newVal) |
atomically compare size_t value with expected and if equal swap with new value More... | |
EPICS_ATOMIC_INLINE int | epicsAtomicCmpAndSwapIntT (int *pTarget, int oldVal, int newVal) |
atomically compare int value with expected and if equal swap with new value More... | |
EPICS_ATOMIC_INLINE EpicsAtomicPtrT | epicsAtomicCmpAndSwapPtrT (EpicsAtomicPtrT *pTarget, EpicsAtomicPtrT oldVal, EpicsAtomicPtrT newVal) |
atomically compare int value with expected and if equal swap with new value More... | |
EPICS_ATOMIC_INLINE size_t | epics::atomic::increment (size_t &v) |
C++ API for atomic size_t increment. More... | |
EPICS_ATOMIC_INLINE int | epics::atomic::increment (int &v) |
C++ API for atomic int increment. More... | |
EPICS_ATOMIC_INLINE size_t | epics::atomic::decrement (size_t &v) |
C++ API for atomic size_t decrement. More... | |
EPICS_ATOMIC_INLINE int | epics::atomic::decrement (int &v) |
C++ API for atomic int decrement. More... | |
EPICS_ATOMIC_INLINE size_t | epics::atomic::add (size_t &v, size_t delta) |
C++ API for atomic size_t addition. More... | |
EPICS_ATOMIC_INLINE int | epics::atomic::add (int &v, int delta) |
C++ API for atomic int addition. More... | |
EPICS_ATOMIC_INLINE size_t | epics::atomic::subtract (size_t &v, size_t delta) |
C++ API for atomic size_t subtraction. More... | |
EPICS_ATOMIC_INLINE int | epics::atomic::subtract (int &v, int delta) |
C++ API for atomic int subtraction. More... | |
EPICS_ATOMIC_INLINE void | epics::atomic::set (size_t &v, size_t newValue) |
C++ API for atomic size_t assignment. More... | |
EPICS_ATOMIC_INLINE void | epics::atomic::set (int &v, int newValue) |
C++ API for atomic int assignment. More... | |
EPICS_ATOMIC_INLINE void | epics::atomic::set (EpicsAtomicPtrT &v, EpicsAtomicPtrT newValue) |
C++ API for atomic pointer assignment. More... | |
EPICS_ATOMIC_INLINE size_t | epics::atomic::get (const size_t &v) |
C++ API for atomic size_t load value. More... | |
EPICS_ATOMIC_INLINE int | epics::atomic::get (const int &v) |
C++ API for atomic int load value. More... | |
EPICS_ATOMIC_INLINE EpicsAtomicPtrT | epics::atomic::get (const EpicsAtomicPtrT &v) |
C++ API for atomic pointer load value. More... | |
EPICS_ATOMIC_INLINE size_t | epics::atomic::compareAndSwap (size_t &v, size_t oldVal, size_t newVal) |
C++ API for atomic size_t compare-and-swap. More... | |
EPICS_ATOMIC_INLINE int | epics::atomic::compareAndSwap (int &v, int oldVal, int newVal) |
C++ API for atomic int compare-and-swap. More... | |
EPICS_ATOMIC_INLINE EpicsAtomicPtrT | epics::atomic::compareAndSwap (EpicsAtomicPtrT &v, EpicsAtomicPtrT oldVal, EpicsAtomicPtrT newVal) |
C++ API for atomic pointer compare-and-swap. More... | |
This is an operating system and compiler independent interface to an operating system and or compiler dependent implementation of several atomic primitives.
These primitives can be safely used in a multithreaded programs on symmetric multiprocessing (SMP) systems. Where possible the primitives are implemented with compiler intrinsic wrappers for architecture specific instructions. Otherwise they are implemeted with OS specific functions and otherwise, when lacking a sufficently capable OS specific interface, then in some rare situations a mutual exclusion primitive is used for synchronization.
In operating systems environments which allow C code to run at interrupt level the implementation must use interrupt level invokable CPU instruction primitives.
All C++ functions are implemented in the namespace atomics which is nested inside of namespace epics.
Definition in file epicsAtomic.h.
typedef void* EpicsAtomicPtrT |
Argument type for atomic operations on pointers
Definition at line 49 of file epicsAtomic.h.
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier | ( | void | ) |
load target into cache
Definition at line 35 of file epicsAtomicOSD.h.
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier | ( | void | ) |
push cache version of target into target
Definition at line 42 of file epicsAtomicOSD.h.
EPICS_ATOMIC_INLINE size_t epicsAtomicIncrSizeT | ( | size_t * | pTarget | ) |
Lock out other smp processors from accessing the target, load target into cache, add one to target, flush cache to target, allow other smp processors to access the target, return new value of target as modified by this operation
pTarget | pointer to target |
Definition at line 49 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE int epicsAtomicIncrIntT | ( | int * | pTarget | ) |
Lock out other smp processors from accessing the target, load target into cache, add one to target, flush cache to target, allow other smp processors to access the target, return new value of target as modified by this operation
pTarget | pointer to target |
Definition at line 36 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE size_t epicsAtomicDecrSizeT | ( | size_t * | pTarget | ) |
Lock out other smp processors from accessing the target, load target into cache, subtract one from target, flush cache to target, allow out other smp processors to access the target, return new value of target as modified by this operation
pTarget | pointer to target |
Definition at line 78 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE int epicsAtomicDecrIntT | ( | int * | pTarget | ) |
Lock out other smp processors from accessing the target, load target into cache, subtract one from target, flush cache to target, allow out other smp processors to access the target, return new value of target as modified by this operation
pTarget | pointer to target |
Definition at line 65 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT | ( | size_t * | pTarget, |
size_t | delta | ||
) |
Lock out other smp processors from accessing the target, load target into cache, add delta
to target, flush cache to target, allow other smp processors to access the target, return new value of target as modified by this operation
pTarget | pointer to target |
delta | value to add to target |
Definition at line 107 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT | ( | size_t * | pTarget, |
size_t | delta | ||
) |
Lock out other smp processors from accessing the target, load target into cache, subtract delta
from target, flush cache to target, allow other smp processors to access the target, return new value of target as modified by this operation
pTarget | pointer to target |
delta | value to subtract from target |
Definition at line 120 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE int epicsAtomicAddIntT | ( | int * | pTarget, |
int | delta | ||
) |
Lock out other smp processors from accessing the target, load target into cache, add delta
to target, flush cache to target, allow other smp processors to access the target, return new value of target as modified by this operation
pTarget | pointer to target |
delta | value to add to target |
Definition at line 94 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE void epicsAtomicSetSizeT | ( | size_t * | pTarget, |
size_t | newValue | ||
) |
set cache version of target to new value, flush cache to target
pTarget | pointer to target |
newValue | desired value of target |
Definition at line 144 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE void epicsAtomicSetIntT | ( | int * | pTarget, |
int | newValue | ||
) |
set cache version of target to new value, flush cache to target
pTarget | pointer to target |
newValue | desired value of target |
Definition at line 136 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE void epicsAtomicSetPtrT | ( | EpicsAtomicPtrT * | pTarget, |
EpicsAtomicPtrT | newValue | ||
) |
set cache version of target to new value, flush cache to target
pTarget | pointer to target |
newValue | desired value of target |
Definition at line 152 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE size_t epicsAtomicGetSizeT | ( | const size_t * | pTarget | ) |
fetch target into cache, return new value of target
pTarget | pointer to target |
Definition at line 172 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE int epicsAtomicGetIntT | ( | const int * | pTarget | ) |
fetch target into cache, return new value of target
pTarget | pointer to target |
Definition at line 164 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicGetPtrT | ( | const EpicsAtomicPtrT * | pTarget | ) |
fetch target into cache, return new value of target
pTarget | pointer to target |
Definition at line 181 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT | ( | size_t * | pTarget, |
size_t | oldVal, | ||
size_t | newVal | ||
) |
lock out other smp processors from accessing the target, load target into cache. If target is equal to oldVal
, set target to newVal
, flush cache to target, allow other smp processors to access the target
pTarget | pointer to target |
oldVal | value that will be compared with target |
newVal | value that will be set to target if oldVal == target |
Definition at line 208 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT | ( | int * | pTarget, |
int | oldVal, | ||
int | newVal | ||
) |
lock out other smp processors from accessing the target, load target into cache. If target is equal to oldVal
, set target to newVal
, flush cache to target, allow other smp processors to access the target
pTarget | pointer to target |
oldVal | value that will be compared with target |
newVal | value that will be set to target if oldVal == target |
Definition at line 192 of file epicsAtomicDefault.h.
EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT | ( | EpicsAtomicPtrT * | pTarget, |
EpicsAtomicPtrT | oldVal, | ||
EpicsAtomicPtrT | newVal | ||
) |
lock out other smp processors from accessing the target, load target into cache. If target is equal to oldVal
, set target to newVal
, flush cache to target, allow other smp processors to access the target
pTarget | pointer to target |
oldVal | value that will be compared with target |
newVal | value that will be set to target if oldVal == target |
Definition at line 225 of file epicsAtomicDefault.h.