Conditionally updates a single word variable atomically.
Standard C library (libc.a)
| Item | Description |
|---|---|
| word_addr | Specifies the address of the single word variable. |
| old_val | Specifies the old value to be checked against the value of the single word variable. |
| new_val | Specifies the new value to be conditionally assigned to the single word variable. |
The _check_lock subroutine performs an atomic (uninterruptible) sequence of operations. The compare_and_swap subroutine is similar, but does not issue synchronization instructions and therefore is inappropriate for updating lock words.
| Item | Description |
|---|---|
| FALSE | Indicates that the single word variable was equal to the old value and has been set to the new value. |
| TRUE | Indicates that the single word variable was not equal to the old value and has been left unchanged. |