Specifications
Multithreading a Device Drive
r
11-11
NOTE
Do not use the plbase priority value for the min_pl argument
This value is invalid because it does not block any interrupts.
lkinfo_p is a pointer to a lkinfo structure. The lk_name component of the
lkinfo structure points to a character string defining a name that identifies the
lock. This name should begin with the driver prefix. The lkinfo structure can be
shared only with other basic locks or read/write locks. It cannot be shared with sleep
locks.
flag specifies if the caller can sleep waiting for memory if sufficient memory is not
immediately available to allocate the synchronization variable. If flag is set to
KM_SLEEP, the caller sleeps if necessary until sufficient memory is available. If flag
is set to KM_NOSLEEP and if sufficient memory is not immediately available, the
routine does not sleep but return immediately.
Upon successful completion, RW_ALLOC returns a pointer to the lock just allocated. If
KM_NOSLEEP is specified and sufficient memory is not immediately available, RW_ALLOC
returns a NULL pointer.
To acquire a read/write lock in read mode, invoke the RW_RDLOCK routine.
#include <sys/types.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
pl_t RW_RDLOCK(lockp, pl)
rwlock_t *lockp;
pl_t pl;
where:
lockp is a pointer to the read/write lock to be acquired.
pl is the interrupt priority level to be set while the lock is held by the caller.
Upon acquiring the lock, the RW_RDLOCK routine returns the previous priority level.
To try to acquire a read/write lock in read mode without causing a busy wait if the lock is
unavailable, invoke the RW_TRYRDLOCK routine.
#include <sys/types.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
pl_t RW_TRYRDLOCK(lockp, pl)
rwlock_t *lockp;
pl_t pl;
where:
lockp is a pointer to the read/write lock to be acquired.
pl is the interrupt priority level to be set while the lock is held by the caller.