[ Previous | Next | Table of Contents | Index | Library Home |
Legal |
Search ]
Technical Reference: Base Operating System and Extensions, Volume 1
Conditionally updates a single word
variable atomically.
Standard C library
(libc.a)
#include <sys/atomic_op.h>
boolean_t _check_lock ( word_addr, old_val, new_val)
atomic_p word_addr;
int old_val;
int new_val;
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.
Note: The
word variable must be aligned on a full word boundary.
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.
|
The _clear_lock (_clear_lock Subroutine) subroutine, _safe_fetch
subroutine.
[ Previous | Next | Table of Contents | Index |
Library Home |
Legal |
Search ]