drw_lock_read_to_write Kernel Service

Purpose

Upgrades a disabled read-write from read-shared to write exclusive mode.

Syntax

#include <sys/lock_def.h>

boolean  drw_lock read_to_write ( lock_addr)
boolean  drw_lock try_read_to_write ( lock_addr)drw_lock_t   lock_addr ;    

Parameters

Item Description
lock_addr Specifies the address of the lock word to lock.

Description

The drw_lock_read_to_write and drw_lock_try_read_to_write kernel services try to upgrade the specified read-write lock from read-shared to write-exclusive mode. The caller must hold the lock in read 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 drw_lock_read_to_write kernel service; it is still held in shared-read mode on return from the drw_lock_try_read_to_write kernel service.

The calling kernel thread must hold the lock in shared-read mode.

Execution Environment

The drw_lock_read_to_write and drw_lock_try_read_to_write kernel services may be called from either the process environment or the interrupt environment. However, if called from the process environment, interrupts must be disabled to some interrupt priority other than INTBASE.

Return Values

The following only apply to drw_lock_read_to_write:

Item Description
TRUE Indicates that the lock was successfully upgraded to exclusive-write mode.
FALSE Indicates that the lock was not upgraded to exclusive-write mode and the lock is no longer held by the caller.

The following only apply to lock_try_read_to_write:

Item Description
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.