STREAMS-UX Programmer's Guide (February 2007)
STREAMS Utilities Supported by HP-UX
Appendix B
228
NAME
TRYLOCK () – Try to acquire a basic lock.
SYNOPSIS
#include <sys/stream.h>
spl_t TRYLOCK(lock_t *lockp, spl_t pl);
PARAMETERS
lockp
Pointer to the basic lock to be acquired.
pl
This value is ignored, and retained for portability only.
DESCRIPTION
If the lock specified by lockp is immediately available (can be acquired without waiting) TRYLOCK acquires
the lock. If the lock is not immediately available, the function returns without acquiring the lock.
RETURN VALUES
If the lock is acquired, TRYLOCK returns the previous interrupt priority level (plbase - plhi). If the lock is
not acquired the value invpl is returned.
CONSTRAINTS
TRYLOCK() can be called from the thread or the interrupt context. Only spinlocks of STREAMS/UX user lock
order can be held across the calls.