SVR5
LOCK(D3)
LOCK --
acquire a basic lock
Synopsis
#include <sys/types.h>
#include <sys/ksynch.h>
#include <sys/ddi.h>
pl_t LOCK(lock_t *lockp, pl_t pl);
Arguments
Description
LOCK sets the interrupt priority level in accordance with the value
specified by pl (if required by the implementation)
and acquires the lock specified by lockp.
If the lock is not immediately available, the caller will wait until the lock
is available.
It is implementation defined
whether the caller will block during the wait.
Some implementations may cause the caller to spin
for the duration of the wait,
while on others the caller may block at some point.
lockp-
Pointer to the basic lock to be acquired.
pl-
The interrupt priority level to be set while the lock is held
by the caller.
Return values
Upon acquiring the lock, LOCK returns the previous interrupt priority
level (plbase - plhi).
Usage
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 on the
pl(D5)
manual page
for additional discussion and a list of the valid values for pl.
Implementations that do not require that the interrupt priority level be
raised during lock acquisition may ignore this argument.
Context and synchronization
Non-blockable, interrupt, user, or blockable
context.
Basic locks are not recursive.
A call to LOCK attempting to acquire a lock that is currently held
by the calling context will result in deadlock.
Calls to LOCK should honor the ordering defined by the
lock
hierarchy(D5)
in
order to avoid deadlock.
When called from interrupt level,
the pl argument must not specify a priority level below the level at
which the interrupt handler is running.
Hardware applicability
All
Version applicability
ddi:
5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp
References
LOCK_ALLOC(D3),
LOCK_DEALLOC(D3),
pl(D5),
TRYLOCK(D3),
UNLOCK(D3)
``Spin locks (DDI)'' in HDK Technical Reference
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005