Specifications
Multithreading a Device Drive
r
11-21
If an LWP sleeps because of a call to SV_WAIT_SIG, signals can cause the LWP to wake
up. Job control stop signals (SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU) result in the caller’s
entering a stopped state; when continued, SV_WAIT_SIG returns normally as if the LWP
has been wakened by a call to SV_SIGNAL or SV_BROADCAST.
If the routine is interrupted by a signal other than a job control stop signal or by a job con-
trol stop signal that does not result in the caller’s stopping (because the signal has a non-
default disposition), then SV_WAIT_SIG returns immediately—even if no call to
SV_BROADCAST or SV_SIGNAL has occurred.
SV_WAIT_SIG returns TRUE if it returns because of a normal wake up and FALSE (non-
zero) if it returns because of an abnormal wake up caused by a signal.
NOTE
When you use SV_WAIT_SIG, you must be prepared for prema-
ture returns. Refer to “Blocking Primitives and Premature
Returns” on page 10-25 for the procedures to use in your driver to
allow for such returns.
To wake only one LWP sleeping on a synchronization variable, use the SV_SIGNAL rou-
tine:
#include <sys/ksynch.h>
#include <sys/ddi.h>
void SV_SIGNAL(svp
,
flags)
sv_t *svp
;
int flags
;
where:
svp is a pointer to the synchronization variable to be signaled.
flags is a bit field for flags. No flags are currently defined for use in drivers, and the
flags argument must be set to 0.
The SV_SIGNAL routine has no return value.
Each LWP that wakes up needs to recheck the sleep condition in case some other LWP has
been awakened first and changed this condition.
To wake up all LWPs sleeping on a synchronization variable,. use the SV_BROADCAST
routine:
#include <sys/ksynch.h>
#include <sys/ddi.h>
void SV_BROADCAST(svp
,
flags)
sv_t *svp
;
int flags
;
where: