Locks a complex lock in shared-read mode.
#include <sys/lock_def.h>
void lock_read (lock_addr) complex_lock_t lock_addr;
boolean_t lock_try_read (lock_addr) complex_lock_t lock_addr;
lock_addr | Specifies the address of the lock word to lock. |
The lock_read kernel service locks the specified complex lock in shared-read mode; it blocks if the lock is locked in exclusive-write mode. The lock must previously have been initialized with the lock_init kernel service. The lock_read kernel service has no return values.
The lock_try_read kernel service tries to lock the specified complex lock in shared-read mode; it returns immediately if the lock is locked in exclusive-write mode, otherwise it locks the lock in shared-read mode. The lock must previously have been initialized with the lock_init kernel service.
The lock_read and lock_try_read kernel services can be called from the process environment only.
The lock_try_read kernel service has the following return values:
TRUE | Indicates that the lock was successfully acquired in shared-read mode. |
FALSE | Indicates that the lock was not acquired. |
The lock_read and lock_try_read kernel services are part of the Base Operating System (BOS) Runtime.
The lock_init kernel service, lock_islocked kernel service, lock_done kernel service.
Understanding Locking and Locking Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts