Specifications
D
evice Driver Programming
11-12
Upon acquiring the lock, the RW_TRYRDLOCK routine returns the previous priority level.
If the lock is not acquired, the RW_TRYRDLOCK routine returns the value invpl (invalid
IPL).
To acquire a read/write lock in write mode, invoke the RW_WRLOCK routine.
#include <sys/types.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
pl_t RW_WRLOCK(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_WRLOCK 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_TRYWRLOCK routine.
#include <sys/types.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
pl_t RW_TRYWRLOCK(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_TRYWRLOCK routine returns the previous priority level.
If the lock is not acquired, the RW_TRYWRLOCK routine returns the value invpl (invalid
IPL).
To release a read/write lock, there is a single routine: RW_UNLOCK.
#include <sys/types.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
void RW_UNLOCK(lockp
,
pl)
rwlock_t *lockp;
pl_t pl
;
where:
lockp is a pointer to the read/write lock to be released.