[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Kernel and Subsystems, Volume 1

lock_read_to_write or lock_try_read_to_write Kernel Service

Purpose

Upgrades a complex lock from shared-read mode to exclusive-write mode.

Syntax

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

Parameter

lock_addr Specifies the address of the lock word to be converted from read-shared to write-exclusive mode.

Description

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.

Execution Environment

The lock_read_to_write and lock_try_read_to_write kernel services can be called from the process environment only.

Return Values

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.

Related Information

The lock_init kernel service, lock_islocked kernel service, lock_done kernel service.

Understanding Locking and Locking Kernel Services in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]