Atomically tests and sets a memory location.
Standard C library (libc.a)
#include <sys/atomic_op.h>
boolean_t test_and_set (word_addr, mask)
atomic_p word_addr;
int mask;
The test_and_set subroutine attempts to atomically OR the value stored at word_addr with the value specified by mask. If any bit in mask was already set in the value stored at word_addr, no update is made.
| Item | Description |
|---|---|
| word_addr | Specifies the address of the memory location to be set. |
| mask | Specifies the mask value to be used to set the memory location specified by word_addr. |
The test_and_set subroutine returns true if the the value stored at word_addr was updated. Otherwise, it returns false.