RW_WRLOCK(D3) RW_WRLOCK(D3)
NAME
RW_WRLOCK - acquire a read/write lock in write mode
SYNOPSIS
#include <sys/types.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
pl_t RW_WRLOCK(rwlock_t *lockp, pl_t pl);
Arguments
lockp Pointer to the read/write lock to be acquired.
pl The interrupt priority level to be set while the
lock is held by the caller.
DESCRIPTION
The RW_WRLOCK function sets the interrupt priority level in
accordance with the value specified by pl (if required by the
implementation) and acquires the lock specified by lockp in
write mode. If the lock cannot be acquired immediately in
write mode, the caller will wait until the lock is available
in write mode. (A read/write lock is available in write mode
when the lock is not held by any context). It is
implementation defined whether the caller will block during
the wait. Some implementations may cause the caller to spin
for the duration of the wait, while on other implementations
the caller may block at some point.
Return Values
Upon acquiring the lock, RW_WRLOCK returns the previous
interrupt priority level (plbase - plhi).
USAGE
Because some implementations require that interrupts that
might attempt to acquire the lock be blocked on the processor
on which the lock is held, portable drivers must specify a pl
value that is sufficient to block out any interrupt handler
that might attempt to acquire this lock. See the description
of the min_pl argument to RW_ALLOC(D3) for additional
discussion and a list of the valid values for pl.
Implementations which do not require that the interrupt
priority level be raised during lock acquisition may choose to
ignore this argument.
Copyright 1994 Novell, Inc. Page 1
RW_WRLOCK(D3) RW_WRLOCK(D3)
When called from interrupt level, the pl argument must not
specify a priority level below the level at which the
interrupt handler is running.
Level
Base or Interrupt.
Synchronization Constraints
Driver-defined sleep locks may be held across calls to this
function.
Driver-defined basic locks and read/write locks may be held
across calls to this function subject to the hierarchy and
recursion restrictions described below.
Warnings
Read/write locks are not recursive. A call to RW_WRLOCK
attempting to acquire a lock that is currently held by the
calling context may result in deadlock.
Calls to RW_WRLOCK should honor the ordering defined by the
lock hierarchy [see RW_ALLOC(D3)] in order to avoid deadlock.
REFERENCES
RW_ALLOC(D3), RW_DEALLOC(D3), RW_RDLOCK(D3), RW_TRYRDLOCK(D3),
RW_TRYWRLOCK(D3), RW_UNLOCK(D3)
NOTICES
Portability
All processors
Applicability
ddi: 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2