STREAMS-UX Programmer's Guide (February 2007)
STREAMS Utilities Supported by HP-UX
Appendix B
211
NAME
streams_get_sleep_lock () – Obtain the sleep lock.
SYNOPSIS
#include <sys/stream.h>
#include <sys/strenv.h>
lock_t *streams_get_sleep_lock(caddr_t event);
PARAMETERS
event
Kernel address signifying an event for which the caller wishes to wait in sleep.
DESCRIPTION
streams_get_sleep_lock() should be called by modules and drivers in their open/close routines before
sleeping to prevent missing wakeups. After calling this function, the open or close can release spinlocks before
sleeping. Other processes cannot wakeup the open or close between the time it calls
streams_get_sleep_lock() and sleeps through streams_mpsleep().
Modules and drivers must not call the native HP-UX get_sleep_lock() primitive directly, because
STREAMS/UX needs to do some additional synchronization before invoking get_sleep_lock(). Therefore, if
they use get_sleep_lock(), modules and drivers must include <sys/strenv.h> (which redefines
get_sleep_lock to streams_get_sleep_lock), to use get_sleep_lock().
RETURN VALUES
streams_get_sleep_lock obtains a sleep spinlock, and returns a pointer to this lock.
CONSTRAINTS
streams_get_sleep_lock() can be called with a thread context only (that is from open/close routines).
Spinlocks can be held across this function call but should be released before the thread can sleep.