Upgrades a complex lock from shared-read mode to exclusive-write mode.
#include <sys/lock_def.h>
boolean_t lock_read_to_write (lock_addr) complex_lock_t lock_addr;
boolean_t lock_try_read_to_write (lock_addr) complex_lock_t lock_addr;
lock_addr | Specifies the address of the lock word to be converted from read-shared to write-exclusive mode. |
The lock_read_to_write and lock_try_read_to_write kernel services try to upgrade the specified complex lock from shared-read mode to exclusive-write mode. The lock is successfully upgraded if no other thread has already requested write-exclusive access for this lock. If the lock cannot be upgraded, it is no longer held on return from the lock_read_to_write kernel service; it is still held in shared-read mode on return from the lock_try_read_to_write kernel service.
The calling kernel thread must hold the lock in shared-read mode.
The lock_read_to_write and lock_try_read_to_write kernel services can be called from the process environment only.
The following only apply to lock_read_to_write:
TRUE | Indicates that the lock was not upgraded and is no longer held. |
FALSE | Indicates that the lock was successfully upgraded to exclusive-write mode. |
The following only apply to lock_try_read_to_write:
TRUE | Indicates that the lock was successfully upgraded to exclusive-write mode. |
FALSE | Indicates that the lock was not upgraded and is held in read mode. |
The lock_read_to_write and lock_try_read_to_write 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