#include <sys/lock_def.h>
void simple_lock (lock_addr) simple_lock_t lock_addr;
boolean_t simple_lock_try (lock_addr) simple_lock_t lock_addr;
lock_addr | Specifies the address of the lock word to lock. |
The simple_lock kernel service locks the specified lock; it blocks if the lock is busy. The lock must have been previously initialized with the simple_lock_init kernel service. The simple_lock kernel service has no return values.
The simple_lock_try kernel service tries to lock the specified lock; it returns immediately without blocking if the lock is busy. If the lock is free, the simple_lock_try kernel service locks it. The lock must have been previously initialized with the simple_lock_init kernel service.
Note: When using simple locks to protect thread-interrupt critical sections, it is recommended that you use the disable_lock kernel service instead of calling the simple_lock kernel service directly.
The simple_lock and simple_lock_try kernel services can be called from the process environment only.
The simple_lock_try kernel service has the following return values:
TRUE | Indicates that the simple lock has been successfully acquired. |
FALSE | Indicates that the simple lock is busy, and has not been acquired. |
The simple_lock and simple_lock_try kernel services are part of the Base Operating System (BOS) Runtime.
The disable_lock kernel service, lock_mine kernel service, simple_lock_init kernel service, simple_unlock kernel service.
Understanding Locking and Locking Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts