cas.h File Reference
CAS implementation using the cmpxchg x86 instruction.
More...
Go to the source code of this file.
|
Typedefs |
typedef unsigned long | word_t |
Functions |
__inline__ int | cas (word_t *ref, word_t exp, word_t val) |
| Compare and swap emulated using CMPXCHG.
|
Detailed Description
CAS implementation using the cmpxchg x86 instruction.
Typedef Documentation
Function Documentation
Compare and swap emulated using CMPXCHG.
Register EAX (exp) holds the value expected to be stored at the specified memory location (*ref). If this value is still stored there, the memory location gets overwritten by the new value (val). The function returns nonzero (true) if the new value was stored, zero (false) otherwise.
Note: extern inline forces GCC to always inline this function an to not generate a standalone version of the function.