1freezestr(9F) Kernel Functions for Drivers freezestr(9F)
2
3
4
6 freezestr, unfreezestr - freeze, thaw the state of a stream
7
9 #include <sys/stream.h>
10 #include <sys/ddi.h>
11
12
13
14 void freezestr(queue_t *q);
15
16
17 void unfreezestr(queue_t *q);
18
19
21 Architecture independent level 1 (DDI/DKI).
22
24 q Pointer to the message queue to freeze/unfreeze.
25
26
28 freezestr() freezes the state of the entire stream containing the queue
29 pair q. A frozen stream blocks any thread attempting to enter any open,
30 close, put or service routine belonging to any queue instance in the
31 stream, and blocks any thread currently within the stream if it
32 attempts to put messages onto or take messages off of any queue within
33 the stream (with the sole exception of the caller). Threads blocked by
34 this mechanism remain so until the stream is thawed by a call to
35 unfreezestr().
36
37
38 Drivers and modules must freeze the stream before manipulating the
39 queues directly (as opposed to manipulating them through programmatic
40 interfaces such as getq(9F), putq(9F), putbq(9F), etc.)
41
43 These routines may be called from any stream open, close, put or ser‐
44 vice routine as well as interrupt handlers, callouts and call-backs.
45
47 Writing Device Drivers
48
49
50 STREAMS Programming Guide
51
53 The freezestr() and unfreezestr() functions can have a serious impact
54 on system performance. Their use should be very limited. In most cases,
55 there is no need to use freezestr() and there are usually better ways
56 to accomplish what you need to do than by freezing the stream.
57
58
59 Calling freezestr() to freeze a stream that is already frozen by the
60 caller will result in a single-party deadlock.
61
62
63 The caller of unfreezestr() must be the thread who called freezestr().
64
65
66 STREAMS utility functions such as getq(9F), putq(9F), putbq(9F), and so
67 forth, should not be called by the caller of freezestr() while the
68 stream is still frozen, as they indirectly freeze the stream to ensure
69 atomicity of queue manipulation.
70
71
72
73SunOS 5.11 17 Oct 2000 freezestr(9F)