.TH RW_TRYWRLOCK() "" "" "DDI/DKI Kernel Routine"
.PC "Try to acquire a read/write lock in write mode"
.B "#include <sys/types.h>"
.B "#include <sys/ksynch.h>"
\fBpl_t RW_TRYWRLOCK(\fIlock\^\fB, \fIpriority\^\fB)\fR
\fBrwlock_t *\fIlock\^\fB; pl_t \fIpriority\^\fB;\fR
.PP
.B RW_TRYWRLOCK()
sets the level of interrupt priority to
.IR priority ,
and attempts to acquire
.I lock
in write mode.
.PP
If all goes well,
.B RW_TRYWRLOCK()
returns the previous level of interrupt priority.
Unlike the related function
.BR RW_WRLOCK() ,
this function does not wait for a lock;
rather, if
.I lock
is not available, it fails and returns
.BR invpl .
.SH "See Also"
.B
DDI/DKI kernel routines
.R
.SH Notes
.B RW_TRYWRLOCK()
has base or interrupt priority.
It does not sleep.
.PP
A driver can hold a driver-defined basic lock, read/write lock,
or sleep lock across a call to this function.
.PP
You can call
.B RW_TRYWRLOCK()
to acquire a lock in an order other than that defined by the lock hierarchy.
.PP
When this function is called from interrupt level,
.I priority
must not be below the level at which the interrupt handler is running.
