Reads the value of a single word variable protected by a lock.
#include <sys/atomic_op.h>
int _safe_fetch ( word_addr)
atomic_p word_addr;
word_addr | Specifies the address of the single word variable. |
The _safe_fetch subroutine safely reads and returns a single word value that is protected by a lock. This subroutine is used to read protected data before releasing the lock word with the _clear_lock subroutine. If _safe_fetch is not used, instructions that access data just before a lock release could actually before performed after the lock release.
Note: The word variable must be aligned on a full word boundary.
This subroutine returns the value of the single word variable.
The _safe_fetch subroutine is part of Base Operating System (BOS) Runtime.
Note that the _safe_fetch subroutine is intended for use only with the _check_lock and _clear_lock subroutines.
The _check_lock subroutine, _clear_lock subroutine.