[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

_safe_fetch Subroutine


Reads the value of a single word variable protected by a lock.


Standard C library (libc.a)


#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.

Return Values

This subroutine returns the value of the single word variable.

Implementation Specifics

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_clock subroutines.

Related Information

The _check_lock subroutine, _clear_lock subroutine.

Locking Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts

[ Previous | Next | Contents | Glossary | Home | Search ]