.TH SLEEP_LOCK() "" "" "DDI/DKI Kernel Routine"
.PC "Acquire a sleep lock"
.B "#include <sys/ksynch.h>"
\fBvoid SLEEP_LOCK(\fIlock\^\fB, \fIpriority\^\fB)\fR
\fBsleep_t *\fIlock\^\fB; int \fIpriority\^\fB;\fR
.PP
.B SLEEP_LOCK()
acquires the sleep lock
.IR lock .
If
.I lock
is not available, it puts the calling function to sleep;
when the lock becomes available, the the calling process awakens and returns
If
.I lock
is already held by the calling context, a deadlock occurs.
.PP
The caller is not interrupted by signals while it sleeps within
.BR SLEEP_LOCK() .
The related function
.B SLEEP_LOCK_SIG()
also acquires a sleep lock but can be interrupted by signals.
.PP
.I priority
gives the priority that the calling process wishes to receive after it awakens.
.B SLEEP_LOCK()
recognizes the following values for this argument:
.IP \fBpridisk\fR 1.0i
Priority for a disk driver.
.IS \fBprinet\fR
Priority for a network driver.
.IS \fBpritty\fR
Priority for a terminal driver.
.IS \fBpritape\fR
Priority for a tape driver.
.IS \fBprihi\fR
High priority.
.IS \fBprimed\fR
Medium priority.
.IS \fBprilo\fR
Low priority.
.PP
You can specify positive or negative offsets from these values;
positive offsets request favorable priority.
The maximum allowable offset is three.
.SH "See Also"
.B
DDI/DKI kernel routines
.R
.SH Notes
.B SLEEP_LOCK()
has base level only.
It can sleep.
.PP
A driver cannot hold a driver-defined basic lock or read/write locks
across a call to this function.
A driver can hold a driver-defined sleep lock, assuming that it does
not attempt to acquire that lock with this function.
