#include <sys/param.h> #include <sys/types.h>
int sleep(caddr_t address, int priority);
This value also determines whether the sleeping process can be interrupted by a software signal. of priority is used to determine whether the sleeping process can be interrupted by a software signal. If priority is less than PZERO, then the sleeping process cannot be interrupted by a software signal.
If the process sleeps in an interruptable state, priority can be OR'ed with PCATCH to have control return to the driver on a signal. If PCATCH is not set, a signal causes control to jump back to the process state just after the system call was made.
If the driver sleeps with PCATCH set,
the driver should be coded to handle catching the signal.
The driver should clear any flags that were set
and free temporarily allocated memory,
u.u_error to EINTR, and return -1.
If priority has not been ORed with PCATCH and the sleeping process is interrupted by a software signal, sleep( ) does not return control to the device driver. Instead, sleep( ) returns control to the process state just after the system call was made. The system call invoked by the user process will return -1 and errno will be set to EINTR.
Most processes should sleep at priorities greater than PZERO so that users are able to force termination of their processes by a software signal if an error occurs. A process should only sleep at a priority less than PZERO if it is guaranteed that the event for which it is waiting will occur within a short time.
See ``Examples'' on the wakeup(D3oddi) manual page for more information.
All locks that are held are released, in the opposite order of allocation, when the process goes to sleep, then reacquired on wakeup in the same order as they were originally allocated.
sleep( ) causes a PANIC in both uni- and multiprocessor systems if it is called from interrupt context or if it is called at STREAMS runtime.
Note that, while SCO OpenServer releases all spin locks when sleep( ) is called and reacquires them after the wakeup( ) is processed, the context of a DDI driver is changed to non-blockable when a lock is acquired, so DDI drivers cannot call sleep( ) while holding a spin lock.
``Delays and busy-waits'' in HDK Technical Reference
``Synchronization variables'' in HDK Technical Reference