__check_lock_mp, __check_lockd_mp
Purpose
Check Lock on Multiprocessor Systems, Check Lock Doubleword on Multiprocessor Systems
Conditionally updates a single word or doubleword variable atomically.
Prototype
unsigned int __check_lock_mp (const int* addr, int old_value, int new_value);
unsigned int __check_lockd_mp (const long long* addr, long long old_value, long long new_value);
Parameters
- addr
- The address of the variable to be updated. Must be aligned on a 4-byte boundary for a single word or on an 8-byte boundary for a doubleword.
- old_value
- The old value to be checked against the current value in addr.
- new_value
- The new value to be conditionally assigned to the variable in addr,
Return value
Returns false (0) if the value in addr was equal to old_value and has been set to the new_value. Returns true (1) if the value in addr was not equal to old_value and has been left unchanged.
Note:
This function generates the hardware instruction but does not act as an instruction movement barrier within the compiler. If that is needed, you must also use the __fence function.


