freezestr(9F)
NAME
freezestr, unfreezestr − freeze, thaw the state of a stream
SYNOPSIS
#include <sys/stream.h>
#include <sys/ddi.h>
void freezestr(queue_t ∗q);
void unfreezestr(queue_t ∗q);
ARGUMENTS
q Pointer to the message queue to freeze/unfreeze.
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
DESCRIPTION
freezestr() freezes the state of the entire stream containing the queue pair q. A frozen stream blocks any thread attempting to enter any open, close, put or service routine belonging to any queue instance in the stream, and blocks any thread currently within the stream if it attempts to put messages onto or take messages off of any queue within the stream (with the sole exception of the caller). Threads blocked by this mechanism remain so until the stream is thawed by a call to unfreezestr().
Drivers and modules must freeze the stream before manipulating the queues directly (as opposed to manipulating them through programmatic interfaces such as getq(9F), putq(9F), putbq(9F), etc.) They further must freeze the stream before accessing any queues through calls to insq(9F), rmvq(9F), strqset(9F) and strqget(9F).
CONTEXT
These routines may be called from any stream open, close, put or service routine as well as interrupt handlers, callouts and call-backs.
SEE ALSO
getq(9F), insq(9F), putbq(9F), putq(9F), rmvq(9F), strqget(9F), strqset(9F)
NOTES
Calling freezestr() to freeze a stream that is already frozen by the caller will result in a single-party deadlock.
The caller of unfreezestr() must be the thread who called freezestr().
Global kernel locks and locks local to drivers and modules may be held across calls to these two routines. Beware of hierarchy violations with respect to local locks (locking policies established by the driver or module writer).
There are usually better ways to accomplish things than by freezing the stream.
STREAMS utility functions such as getq(9F), putq(9F), putbq(9F), etc. may not be called by the caller of freezestr() while the stream is still frozen, as they indirectly freeze the stream to ensure atomicity of queue manipulation.
Sun Microsystems — Last change: 28 Jan 1993