Interface __PrefixOpSuffixCondition
Inline function
Space | User/kernel |
Context | Sync/async/rt-irq |
May block | No |
SPL | Any |
Dynamic memory | No |
#include <ARCH/BITOPS.H>
static __finline__ int __PrefixOpSuffixCondition(type *ptr, type val);
Description
This family of inline functions perform an atomic logical operation on memory. The operation will be performed between val and ptr location and the result will be stored at ptr location. Additionally, they return a status returned by the operation.
Parts of function name — Op, Suffix, Prefix and Condition determine logical operation, data type, atomicity requirements and returned condition.
Arguments
- Prefix — This is the part of function name. It specifies atomicity of the operation.
- empty — Perform an operation that is atomic with respect to events on the CPU itself (ASTs or real time interrupts) but it is not atomic with respect to other CPUs or busmasters.
- LOCK_ — The operation will contain lock prefix, making it atomic with respect to other CPUs and bus mastering devices.
- Op — Determine the operation itself. Possibilities:
- ADD — Adding two values.
- SUB — Subtract val from memory location.
- Suffix — This is the part of function name. It determines argument types:
- C — argument has the type signed or unsigned char or __s8 or __u8.
- I — argument has the type signed or unsigned int.
- L — argument has the type signed or unsigned long.
- 32 — argument has the type __u32 or __s32.
- Condition — This is the part of functino name. It determines condition that will be returned:
- C — a carry flag was set
- NZ — the result is non-zero
- S — the result is negative
- ptr — Pointer pointing to a memory location that should be atomically changed.
- val — A value that will be bitwise-ORed at location ptr.
Returns
If the condition was true after the operation, 1 is returned. Otherwise, 0 is returned.
See also
__PrefixOpSuffix __PrefixCMPXCHGSuffix