STREAMS-UX Programmer's Guide (February 2007)
STREAMS Utilities Supported by HP-UX
Appendix B
226
NAME
SV_WAIT () – Sleep on a synchronization variable.
SYNOPSIS
#include <sys/stream.h>
void SV_WAIT(sv_t *svp, int priority, lock_t *lkp);
PARAMETERS
svp
Pointer to the synchronization variable on which to sleep.
priority
The priority value passed here is subtracted from PZERO-1. pridisk, prinet, pritty,
pritape, prihi, primed and prilo are defined to be 0 and do not affect the caller’s priority.
To change the process’s priority, study the priorities in /usr/include/sys/param.h and
pass the needed offset to PZERO-1 in the priority parameter.
lkp
Pointer to a basic lock which must be locked when SV_WAIT is called. The basic lock is
released when the calling process goes to sleep.
DESCRIPTION
SV_WAIT causes the calling process to sleep (the caller’s execution is suspended and other processes may be
scheduled) waiting for a call to SV_BROADCAST (D3) for the synchronization variable specified by
svp
.
The basic lock specified by lkp must be held by the caller upon entry. When SV_WAIT returns, the lkp spinlock
is not held and SV_WAIT lowers the priority level to the value before the caller acquired the lkp spinlock,
which may not be SPLNOPREEMPT. If the caller acquired the lock while holding other spinlocks, the priority
level is lowered to the value before the first of these nested spinlock calls.
RETURN VALUES
None
CONSTRAINTS
SV_WAIT() sleeps and can only be called from the thread context. Spinlocks (with the exception of the lock
specified in lkp) cannot be held across this call.