RW_TRYWRLOCK(D3DK) —
NAME
RW_TRYWRLOCK − try to acquire a read/write lock in write mode .IX \f4RW_TRYWRLOCK\fP(D3DK)
SYNOPSIS
#include <sys/types.h>
#include <sys/ksynch.h>
pl_t RW_TRYWRLOCK(rwlock_t ∗lockp, pl_t pl);
ARGUMENTS
lockpPointer to the read/write lock to be acquired.
plThe interrupt priority level to be set while the lock is held by the caller. 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(D3DK) 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.
DESCRIPTION
If the lock specified by lockp is immediately available in write mode (no context is holding the lock in read mode or write mode), RW_TRYWRLOCK sets the interrupt priority level in accordance with the value specified by pl (if required by the implementation) and acquires the lock in write mode. If the lock is not immediately available in write mode, the function returns without acquiring the lock.
RETURN VALUE
If the lock is acquired, RW_TRYWRLOCK returns the previous interrupt priority level (plbase - plhi). If the lock is not acquired the value invpl is returned.
LEVEL
Base or Interrupt.
NOTES
Does not sleep. RW_TRYWRLOCK may be used to acquire a lock in a different order from the order defined by the lock hierarchy. Driver defined basic locks, read/write locks, and sleep locks may be held across calls to this function. When called from interrupt level, the pl argument must not specify a priority level below the level at which the interrupt handler is running.
SEE ALSO
RW_ALLOC(D3DK), RW_DEALLOC(D3DK), RW_RDLOCK(D3DK), RW_TRYRDLOCK(D3DK), RW_UNLOCK(D3DK), RW_WRLOCK(D3DK)
DDI/DKI