Imported Upstream version 3.0.4
[debian/gnuradio] / gnuradio-core / doc / other / omnithread.ps
1 %!PS-Adobe-2.0
2 %%Creator: dvipsk 5.86 p1.5d Copyright 1996-2001 ASCII Corp.(www-ptex@ascii.co.jp)
3 %%based on dvipsk 5.86 Copyright 1999 Radical Eye Software (www.radicaleye.com)
4 %%Title: omnithread.dvi
5 %%Pages: 7
6 %%PageOrder: Ascend
7 %%BoundingBox: 0 0 596 842
8 %%DocumentFonts: Palatino-Roman Palatino-Italic Palatino-Bold Courier
9 %%EndComments
10 %DVIPSWebPage: (www.radicaleye.com)
11 %DVIPSCommandLine: dvips omnithread
12 %DVIPSParameters: dpi=600, compressed
13 %DVIPSSource:  TeX output 2002.08.15:1756
14 %%BeginProcSet: texc.pro
15 %!
16 /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
17 N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72
18 mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0
19 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{
20 landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize
21 mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[
22 matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round
23 exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{
24 statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0]
25 N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin
26 /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array
27 /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2
28 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N
29 df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A
30 definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get
31 }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub}
32 B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr
33 1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3
34 1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx
35 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx
36 sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{
37 rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp
38 gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B
39 /chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{
40 /cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{
41 A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy
42 get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse}
43 ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp
44 fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17
45 {2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add
46 chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{
47 1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop}
48 forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn
49 /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put
50 }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{
51 bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A
52 mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{
53 SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{
54 userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X
55 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4
56 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N
57 /dir 0 def/dyy{/dir 0 def}B/dyt{/dir 1 def}B/dty{/dir 2 def}B/dtt{/dir 3
58 def}B/p{dir 2 eq{-90 rotate show 90 rotate}{dir 3 eq{-90 rotate show 90
59 rotate}{show}ifelse}ifelse}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0
60 N/Ry 0 N/V{}B/RV/v{/Ry X/Rx X V}B statusdict begin/product where{pop
61 false[(Display)(NeXT)(LaserWriter 16/600)]{A length product length le{A
62 length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}
63 forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{
64 BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat
65 {BDot}imagemask grestore}}ifelse B/QV{gsave newpath transform round exch
66 round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0
67 rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B
68 /M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}
69 B/g{0 M}B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p
70 -3 w}B/n{p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{
71 0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end
72
73 %%EndProcSet
74 %%BeginProcSet: 8r.enc
75 % @@psencodingfile@{
76 %   author = "S. Rahtz, P. MacKay, Alan Jeffrey, B. Horn, K. Berry",
77 %   version = "0.6",
78 %   date = "1 July 1998",
79 %   filename = "8r.enc",
80 %   email = "tex-fonts@@tug.org",
81 %   docstring = "Encoding for TrueType or Type 1 fonts
82 %                to be used with TeX."
83 % @}
84
85 % Idea is to have all the characters normally included in Type 1 fonts
86 % available for typesetting. This is effectively the characters in Adobe
87 % Standard Encoding + ISO Latin 1 + extra characters from Lucida.
88
89 % Character code assignments were made as follows:
90
91 % (1) the Windows ANSI characters are almost all in their Windows ANSI
92 % positions, because some Windows users cannot easily reencode the
93 % fonts, and it makes no difference on other systems. The only Windows
94 % ANSI characters not available are those that make no sense for
95 % typesetting -- rubout (127 decimal), nobreakspace (160), softhyphen
96 % (173). quotesingle and grave are moved just because it's such an
97 % irritation not having them in TeX positions.
98
99 % (2) Remaining characters are assigned arbitrarily to the lower part
100 % of the range, avoiding 0, 10 and 13 in case we meet dumb software.
101
102 % (3) Y&Y Lucida Bright includes some extra text characters; in the
103 % hopes that other PostScript fonts, perhaps created for public
104 % consumption, will include them, they are included starting at 0x12.
105
106 % (4) Remaining positions left undefined are for use in (hopefully)
107 % upward-compatible revisions, if someday more characters are generally
108 % available.
109
110 % (5) hyphen appears twice for compatibility with both 
111 % ASCII and Windows.
112
113 /TeXBase1Encoding [
114 % 0x00 (encoded characters from Adobe Standard not in Windows 3.1)
115   /.notdef /dotaccent /fi /fl
116   /fraction /hungarumlaut /Lslash /lslash
117   /ogonek /ring /.notdef
118   /breve /minus /.notdef 
119 % These are the only two remaining unencoded characters, so may as
120 % well include them.
121   /Zcaron /zcaron 
122 % 0x10
123  /caron /dotlessi 
124 % (unusual TeX characters available in, e.g., Lucida Bright)
125  /dotlessj /ff /ffi /ffl 
126  /.notdef /.notdef /.notdef /.notdef
127  /.notdef /.notdef /.notdef /.notdef
128  % very contentious; it's so painful not having quoteleft and quoteright
129  % at 96 and 145 that we move the things normally found there to here.
130  /grave /quotesingle 
131 % 0x20 (ASCII begins)
132  /space /exclam /quotedbl /numbersign
133  /dollar /percent /ampersand /quoteright
134  /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash
135 % 0x30
136  /zero /one /two /three /four /five /six /seven
137  /eight /nine /colon /semicolon /less /equal /greater /question
138 % 0x40
139  /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O
140 % 0x50
141  /P /Q /R /S /T /U /V /W
142  /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
143 % 0x60
144  /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o
145 % 0x70
146  /p /q /r /s /t /u /v /w
147  /x /y /z /braceleft /bar /braceright /asciitilde
148  /.notdef % rubout; ASCII ends
149 % 0x80
150  /.notdef /.notdef /quotesinglbase /florin
151  /quotedblbase /ellipsis /dagger /daggerdbl
152  /circumflex /perthousand /Scaron /guilsinglleft
153  /OE /.notdef /.notdef /.notdef
154 % 0x90
155  /.notdef /.notdef /.notdef /quotedblleft
156  /quotedblright /bullet /endash /emdash
157  /tilde /trademark /scaron /guilsinglright
158  /oe /.notdef /.notdef /Ydieresis
159 % 0xA0
160  /.notdef % nobreakspace
161  /exclamdown /cent /sterling
162  /currency /yen /brokenbar /section
163  /dieresis /copyright /ordfeminine /guillemotleft
164  /logicalnot
165  /hyphen % Y&Y (also at 45); Windows' softhyphen
166  /registered
167  /macron
168 % 0xD0
169  /degree /plusminus /twosuperior /threesuperior
170  /acute /mu /paragraph /periodcentered
171  /cedilla /onesuperior /ordmasculine /guillemotright
172  /onequarter /onehalf /threequarters /questiondown
173 % 0xC0
174  /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
175  /Egrave /Eacute /Ecircumflex /Edieresis
176  /Igrave /Iacute /Icircumflex /Idieresis
177 % 0xD0
178  /Eth /Ntilde /Ograve /Oacute
179  /Ocircumflex /Otilde /Odieresis /multiply
180  /Oslash /Ugrave /Uacute /Ucircumflex
181  /Udieresis /Yacute /Thorn /germandbls
182 % 0xE0
183  /agrave /aacute /acircumflex /atilde
184  /adieresis /aring /ae /ccedilla
185  /egrave /eacute /ecircumflex /edieresis
186  /igrave /iacute /icircumflex /idieresis
187 % 0xF0
188  /eth /ntilde /ograve /oacute
189  /ocircumflex /otilde /odieresis /divide
190  /oslash /ugrave /uacute /ucircumflex
191  /udieresis /yacute /thorn /ydieresis
192 ] def
193
194 %%EndProcSet
195 %%BeginProcSet: texps.pro
196 %!
197 TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2
198 index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll
199 exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]/Metrics
200 exch def dict begin 0 1 255{exch dup type/integertype ne{pop pop 1 sub
201 dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def}
202 ifelse}for Metrics/Metrics currentdict end def[2 index currentdict end
203 definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{dup
204 sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1 roll
205 mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def dup[
206 exch{dup CharStrings exch known not{pop/.notdef/Encoding true def}if}
207 forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def}def
208 end
209
210 %%EndProcSet
211 TeXDict begin 39158280 55380996 1000 600 600 (omnithread.dvi)
212 @start /Fa 134[ 45 45 66 1[ 51 30 35 35 1[ 45 40 51 71
213 25 2[ 25 45 45 25 35 45 37 42 40 8[ 66 3[ 56 51 2[ 56
214 71 5[ 30 3[ 56 3[ 66 23[ 30 30 40[{ TeXBase1Encoding ReEncodeFont} 31
215 90.9091 /Palatino-Italic rf /Fb 134[ 51 1[ 76 1[ 56 30
216 40 35 2[ 51 56 81 30 2[ 30 56 51 35 45 56 40 56 45 14[ 66
217 2[ 76 5[ 35 6[ 61 19[ 23 30 23 4[ 25 39[{ TeXBase1Encoding ReEncodeFont}
218 27 90.9091 /Palatino-Bold rf /Fc 135[ 50 83 1[ 61 33
219 44 39 1[ 61 55 61 89 33 2[ 33 61 55 1[ 50 61 44 61 50
220 10[ 78 8[ 100 9[ 72 12[ 50 1[ 50 50 50 50 2[ 25 4[ 33
221 33 40[{ TeXBase1Encoding ReEncodeFont} 30 99.6264 /Palatino-Bold
222 rf /Fd 134[ 55 55 55 55 55 55 55 55 55 55 55 55 55 55
223 55 55 55 55 55 55 55 55 55 55 55 1[ 55 5[ 55 55 55 55
224 55 55 55 55 1[ 55 55 55 55 55 55 1[ 55 55 55 55 55 55
225 55 55 55 3[ 55 2[ 55 1[ 55 1[ 55 55 55 55 55 55 55 1[ 55
226 55 55 1[ 55 55 55 40[{ TeXBase1Encoding ReEncodeFont} 65
227 90.9091 /Courier rf /Fe 141[ 36 12[ 44 56 2[ 45 7[ 61
228 61 91 1[ 71 56 48 61 2[ 71 76 3[ 30 31 76 1[ 51 56 70
229 64 56 71 10[ 45 3[ 45 45 1[ 55 23 4[ 30 30 40[{
230 .167 SlantFont TeXBase1Encoding ReEncodeFont} 29 90.9091
231 /Palatino-Roman rf
232 %DVIPSBitmapFont: Ff cmsy10 10.95 1
233 /Ff 1 16 df<EB0FFCEB3FFF90B512C0000314F04880488048804880A2481580A3B712C0
234 AA6C1580A36C1500A26C5C6C5C6C5C6C5CC614C0013F90C7FCEB0FFC22227BA72D> 15
235 D E
236 %EndDVIPSBitmapFont
237 /Fg 104[ 91 2[ 45 45 24[ 45 51 47 76 51 55 30 39 36 51
238 55 50 53 80 26 51 21 26 53 51 30 44 56 40 50 45 3[ 30
239 1[ 30 2[ 61 91 66 71 56 48 61 1[ 55 71 76 86 56 66 30
240 31 76 1[ 51 56 70 64 56 71 6[ 23 45 45 45 45 45 45 45
241 45 45 45 55 23 30 23 55 1[ 30 30 25 4[ 34 30[ 55 55 2[{
242 TeXBase1Encoding ReEncodeFont} 75 90.9091 /Palatino-Roman
243 rf /Fh 134[ 66 60 100 1[ 73 40 53 47 1[ 73 66 73 106
244 2[ 40 40 73 66 47 60 73 53 73 60 11[ 93 80 73 86 1[ 73
245 100 100 120 3[ 47 18[ 60 60 60 60 60 60 1[ 35 1[ 40 45[{
246 TeXBase1Encoding ReEncodeFont} 38 119.552 /Palatino-Bold
247 rf /Fi 137[ 50 2[ 39 9[ 28 3[ 39 50 17[ 66 82[{
248 TeXBase1Encoding ReEncodeFont} 6 99.6264 /Palatino-Italic
249 rf /Fj 137[ 56 1[ 32 42 39 2[ 54 58 88 3[ 29 58 55 1[ 48
250 61 44 55 50 12[ 61 1[ 67 3[ 83 1[ 61 8[ 71 1[ 78 14[ 50
251 50 50 9[ 78 38[{ TeXBase1Encoding ReEncodeFont} 25 99.6264
252 /Palatino-Roman rf /Fk 139[ 47 61 57 2[ 78 83 4[ 42 83
253 2[ 69 88 64 79 72 12[ 88 4[ 113 119 136 3[ 48 7[ 112
254 65[{ TeXBase1Encoding ReEncodeFont} 18 143.462 /Palatino-Roman
255 rf end
256 %%EndProlog
257 %%BeginSetup
258 %%Feature: *Resolution 600dpi
259 TeXDict begin
260 %%PaperSize: A4
261
262 %%EndSetup
263 %%Page: 1 1
264 1 0 bop Fk 728 918 a(The) 36 b(OMNI) g(Thr) m(ead) f(Abstracti) n(on) p
265 Fj 1293 1176 a(T) -9 b(ristan) 26 b(Richar) n(dson) 1022
266 1293 y(A) -7 b(T&T) 24 b(Laboratories) i(Cambridge) p
267 Fi 1192 1504 a(Revised) p Fj 24 w(November) f(2001) p
268 Fh 63 1961 a(1) 119 b(Introduction) p Fg 63 2183 a(The) 20
269 b(OMNI) h(thr) n(ead) g(abstraction) g(is) h(des) n(igned) f(to) f(pr) n
270 (ovide) h(a) h(common) f(set) f(of) h(thr) n(ead) g(oper) n(-) 63
271 2296 y(ations) h(for) g(use) g(in) h(pr) n(ograms) f(written) f(in) i
272 (C++.) 29 b(Pr) n(ograms) 22 b(written) g(using) f(the) h(abstraction)
273 63 2409 y(should) 30 b(be) g(much) i(easier) e(to) g(port) g(betwee) n
274 (n) h(dif) n(fer) n(ent) g(ar) n(chi) r(tectur) l(es) g(with) g(dif) n
275 (fer) n(ent) f(un-) 63 2522 y(derlying) 21 b(thr) n(eads) h
276 (primitives.) 204 2640 y(The) 17 b(pr) n(ogramming) h(interface) g(is) f
277 (designed) f(to) h(be) h(similar) h(to) e(the) g(C) i(language) e
278 (interface) 63 2753 y(to) k(POSIX) h(thr) n(eads) f(\(IEEE) g(draft) h
279 (standar) n(d) f(100) r(3.1c) i(\227) f(pr) n(eviously) g(1003) r(.4a,)
280 g(often) g(known) 63 2866 y(as) g(\223pthr) n(eads\224) h([POSIX94]\).)
281 204 2985 y(Much) 18 b(of) f(the) g(abstraction) i(consists) d(of) i
282 (simple) g(C++) g(object) g(wrappers) e(ar) n(ound) h(pthr) n(ead) 63
283 3098 y(calls.) 28 b(Howe) n(ver) 20 b(for) f(some) f(featur) n(es) g
284 (such) h(as) h(thr) n(ead-spe) n(ci\002c) h(data,) f(a) f(better) f
285 (interface) i(can) 63 3211 y(be) i(of) n(fer) n(ed) g(because) h(of) f
286 (the) g(use) g(of) g(C++.) 204 3329 y(Some) 28 b(of) h(the) f(mor) n(e)
287 h(complex) f(featur) n(es) g(of) h(pthr) n(eads) f(ar) n(e) h(not) f
288 (suppo) n(rted) g(because) h(of) 63 3442 y(the) e(dif) n(\002culty) i
289 (of) f(ensuring) g(the) f(same) h(featur) n(es) g(can) h(be) f(of) n
290 (fer) n(ed) g(on) g(top) g(of) g(other) f(thr) n(ead) 63
291 3555 y(sys) n(tems.) f(Such) 17 b(featur) n(es) g(include) h(thr) n
292 (ead) f(cancell) r(ation) g(and) h(complex) g(schedu) n(ling) h(contr) n
293 (ol) 63 3668 y(\(thoug) n(h) k(simple) g(thr) n(ead) f(priorities) g
294 (ar) n(e) h(supp) n(orted\).) 204 3787 y(The) i(abstraction) h(layer) h
295 (is) f(curr) n(ently) f(implemented) g(for) h(the) f(following) i(ar) n
296 (chitectur) n(es) 63 3900 y(/) 22 b(thr) n(ead) h(sys) n(tems:) p
297 Ff 199 4141 a(\017) p Fg 46 w(Solaris) g(2.x) g(using) f(pthr) n(eads) f
298 (draft) h(10) p Ff 199 4351 a(\017) p Fg 46 w(Solaris) h(2.x) g(using) f
299 (solaris) g(thr) n(eads) g(\(but) h(pthr) n(eads) e(version) h(is) h
300 (now) f(standar) n(d\)) p Ff 199 4561 a(\017) p Fg 46
301 w(Alpha) h(OSF1) g(using) f(pthr) n(eads) f(draft) i(4) p
302 Ff 199 4772 a(\017) p Fg 46 w(W) -5 b(indows) 21 b(NT) h(using) g(NT) g
303 (thr) n(eads) p Ff 199 4982 a(\017) p Fg 46 w(Linux) g(2.x) h(using) f
304 (Linuxthr) n(ead) g(0.5) h(\(which) h(is) e(based) g(on) h(pthr) n
305 (eads) e(draft) i(10\)) p Ff 199 5193 a(\017) p Fg 46
306 w(Linux) f(2.x) h(using) f(MIT) g(pthr) n(eads) f(\(which) j(is) f
307 (based) f(on) g(draft) h(8\)) p Ff 199 5403 a(\017) p
308 Fg 46 w(A) -7 b(TMos) 22 b(using) g(pthr) n(eads) f(draft) h(6) i
309 (\(but) e(not) g(V) -5 b(irata) 23 b(A) -7 b(TMos\)) 1684
310 5652 y(1) p 90 rotate dyy eop
311 %%Page: 2 2
312 2 1 bop Fg 221 249 a(2) p Fe 1797 w(2) 91 b(SYNCHRONI) n(SA) -7
313 b(TION) 22 b(OBJECTS) p Fg 362 548 a(See) h(the) p Fd
314 22 w(omni) n(thre) n(ad.h) p Fg 22 w(header) f(\002le) i(for) f(full) i
315 (det) n(ail) r(s) e(of) g(the) g(API.) f(The) h(des) n(criptions) 221
316 661 y(below) 35 b(assume) g(you) g(have) h(some) e(pr) n(evious) h
317 (knowled) n(ge) g(of) h(thr) n(eads) n(,) j(mutexes) n(,) g(condi-) 221
318 774 y(tion) f(varia) r(bles) g(and) g(semaphor) n(es) n(.) 75
319 b(Also) 38 b(r) n(efer) f(to) h(other) f(document) n(ation) i(\([Birr) n
320 (ell89) r(],) 221 887 y([POSIX94) q(]\)) 22 b(for) g(further) f
321 (explanation) i(of) f(thes) n(e) g(ideas) g(\(particularly) h
322 (condition) f(variab) r(les,) 221 1000 y(the) g(use) g(of) g(which) h
323 (may) g(not) f(be) h(particularly) h(intuitive) f(when) f(\002rst) f
324 (encounter) n(ed) n(\).) p Fh 221 1299 a(2) 119 b(Synchronisation) 31
325 b(objects) p Fg 221 1510 a(Synchr) n(onisation) 26 b(objects) h(ar) n
326 (e) g(used) e(to) h(synchr) n(onise) g(thr) n(eads) g(within) h(the) f
327 (same) h(pr) n(ocess) n(.) 221 1623 y(Ther) n(e) j(is) i(no) f(inter) n
328 (-pr) n(ocess) f(synchr) n(onisation) g(pr) n(ovided.) 53
329 b(The) 30 b(synchr) n(onisation) h(objects) 221 1735
330 y(pr) n(ovided) 22 b(ar) n(e) h(mutexes) n(,) g(condition) f(variab) r
331 (les) g(and) h(counting) f(semaphor) n(e) n(s.) p Fc
332 221 1991 a(2.1) 99 b(Mutex) p Fg 221 2168 a(An) 26 b(object) g(of) h
333 (typ) n(e) p Fd 26 w(omni) n(_mute) n(x) p Fg 26 w(is) g(use) n(d) f
334 (for) h(mutual) f(exclusion.) 39 b(It) 26 b(pr) n(ovides) f(two) g(op-)
335 221 2281 y(erations,) p Fd 37 w(lock\() n(\)) p Fg 35
336 w(and) p Fd 35 w(unloc) n(k\(\)) p Fg(.) 64 b(The) 35
337 b(alternative) h(names) p Fd 35 w(acq) n(uire\() n(\)) p
338 Fg 35 w(and) p Fd 35 w(re-) 221 2393 y(leas) n(e\(\)) p
339 Fg 19 w(can) 21 b(be) f(used) f(if) i(pr) n(eferr) n(ed) n(.) 27
340 b(Behaviour) 20 b(is) g(unde\002ne) n(d) g(when) f(a) i(thr) n(ead) f
341 (attempt) n(s) 221 2506 y(to) 30 b(lock) h(the) e(same) i(mutex) f
342 (again) h(or) f(when) g(a) h(mutex) f(is) h(locked) e(by) i(one) e(thr)
343 n(ead) h(and) h(un-) 221 2619 y(locked) 22 b(by) h(a) g(dif) n(fer) n
344 (ent) f(thr) n(ead.) p Fc 221 2874 a(2.2) 99 b(Condition) 26
345 b(V) -11 b(ariable) p Fg 221 3051 a(A) 28 b(condition) f(varia) r(ble) h
346 (is) g(r) n(epr) n(ese) n(nted) f(by) h(an) p Fd 28 w(omn) n(i_con) n
347 (diti) n(on) p Fg 27 w(and) g(is) g(used) e(for) i(sig-) 221
348 3164 y(nalli) r(ng) 20 b(betwee) n(n) g(thr) n(eads.) 26
349 b(A) 21 b(call) h(to) p Fd 19 w(wait\() n(\)) p Fg 20
350 w(causes) e(a) h(thr) n(ead) e(to) h(wait) h(on) f(the) f(condition) 221
351 3277 y(varia) r(ble.) 45 b(A) 28 b(call) i(to) p Fd 27
352 w(sign) n(al\(\)) p Fg 27 w(wakes) d(up) h(at) g(least) g(one) f(thr) n
353 (ead) h(if) h(any) f(ar) n(e) g(waiting.) 45 b(A) 221
354 3390 y(call) 25 b(to) p Fd 22 w(bro) n(adca) n(st\(\)) p
355 Fg 21 w(wakes) d(up) g(all) i(thr) n(eads) e(waiting) h(on) f(the) g
356 (condition) g(varia) r(ble.) 362 3503 y(When) 30 b(constr) o(ucte) n
357 (d,) i(a) e(pointer) f(to) h(an) p Fd 30 w(omni) n(_mute) n(x) p
358 Fg 30 w(must) f(be) h(given.) 50 b(A) 30 b(condition) 221
359 3616 y(varia) r(ble) p Fd 33 w(wait\() n(\)) p Fg 33
360 w(has) j(an) h(implic) r(it) f(mutex) p Fd 33 w(unlo) n(ck\(\)) p
361 Fg 32 w(and) p Fd 33 w(lock) n(\(\)) p Fg 33 w(ar) n(ound) g(it.) 60
362 b(The) 221 3729 y(link) 30 b(between) f(condition) g(varia) r(ble) h
363 (and) g(mutex) f(lasts) g(for) h(the) f(lifetime) i(of) e(the) g
364 (condition) 221 3842 y(varia) r(ble) c(\(unlike) h(pthr) n(eads) e
365 (wher) n(e) g(the) h(link) h(is) f(only) g(for) g(the) g(duration) f
366 (of) i(the) e(wait\).) 37 b(The) 221 3955 y(same) 23
367 b(mutex) f(may) h(be) f(used) f(with) i(several) f(condition) h(variab)
368 r(les.) 362 4068 y(A) c(wait) g(with) g(a) g(timeout) f(can) i(be) e
369 (achieved) h(by) g(call) r(ing) p Fd 19 w(tim) n(ed_w) n(ait\(\)) p
370 Fg -2 w(.) 27 b(This) 18 b(is) h(given) 221 4181 y(an) 27
371 b(absolute) e(time) h(to) f(wait) h(until.) 38 b(The) 26
372 b(r) n(outine) p Fd 25 w(omn) n(i_thr) n(ead:) n(:get_) n(time) n(\(\))
373 p Fg 25 w(can) h(be) 221 4293 y(used) 21 b(to) h(turn) g(a) h(r) n
374 (elativ) r(e) f(time) g(into) h(an) g(absolute) f(time.) p
375 Fd 28 w(tim) n(ed_wa) n(it\(\)) p Fg 21 w(r) n(eturns) p
376 Fd 21 w(true) p Fg 21 w(if) 221 4406 y(the) 27 b(condition) h(was) g
377 (signalled,) p Fd 29 w(false) p Fg 26 w(if) h(the) f(time) g(expir) n
378 (ed) f(befor) n(e) g(the) h(condition) f(vari) r(-) 221
379 4519 y(able) d(was) e(signalled.) p Fc 221 4774 a(2.3) 99
380 b(Counting) 26 b(semaphores) p Fg 221 4951 a(An) p Fd
381 21 w(omn) n(i_sem) n(apho) n(re) p Fg 20 w(is) 21 b(a) h(counting) e
382 (semaphor) n(e) n(.) 28 b(When) 20 b(cr) n(eated) g(it) h(is) g(given) g
383 (an) g(initial) 221 5064 y(unsigned) j(intege) n(r) i(value.) 36
384 b(When) p Fd 25 w(wai) n(t\(\)) p Fg 24 w(is) 26 b(called,) g(the) f
385 (value) h(is) f(decr) n(emente) n(d) g(if) h(non-) 221
386 5177 y(zer) n(o.) 43 b(If) 27 b(the) g(value) h(is) f(zer) n(o) h(then)
387 f(the) f(thr) n(ead) h(blocks) h(instead.) 41 b(When) p
388 Fd 27 w(post) n(\(\)) p Fg 27 w(is) 27 b(cal) r(led,) 221
389 5290 y(if) h(any) g(thr) n(eads) e(ar) n(e) i(blocked) f(in) p
390 Fd 27 w(wait\() n(\)) p Fg(,) h(exactly) f(one) g(thr) n(ead) g(is) g
391 (woken.) 41 b(If) 27 b(no) g(thr) n(eads) 221 5403 y(wer) n(e) 22
392 b(blocked) g(then) g(the) g(value) h(of) g(the) e(semaphor) n(e) h(is) h
393 (incr) n(emented.) p 90 rotate dyy eop
394 %%Page: 3 3
395 3 2 bop Fg 3306 249 a(3) 204 548 y(If) 27 b(a) h(thr) n(ead) e(cal) r
396 (ls) p Fd 27 w(try) n(_wait) n(\(\)) p Fg(,) h(then) g(the) f(thr) n
397 (ead) g(won't) h(block) h(if) f(the) g(semaphor) n(e's) 63
398 661 y(value) c(is) g(0,) g(r) n(eturning) p Fd 21 w(false) p
399 Fg 21 w(instead.) 204 777 y(Ther) n(e) f(is) g(no) h(way) f(of) h
400 (query) n(ing) g(the) f(value) h(of) g(the) f(semaphor) n(e) n(.) p
401 Fh 63 1095 a(3) 119 b(Thread) 29 b(object) p Fg 63 1313
402 a(A) 23 b(thr) n(ead) g(is) h(r) n(epr) n(ese) n(nted) e(by) i(an) p
403 Fd 24 w(omni) n(_thr) n(ead) p Fg 23 w(object.) 30 b(Ther) n(e) 23
404 b(ar) n(e) h(br) n(oadly) g(two) e(dif) n(fer) n(-) 63
405 1426 y(ent) f(ways) i(in) g(which) g(it) g(can) g(be) g(used) n(.) 204
406 1542 y(The) 28 b(\002rst) g(way) h(is) h(simply) f(to) f(cr) n(eate) h
407 (an) p Fd 30 w(omn) n(i_thr) n(ead) p Fg 28 w(object,) h(giving) g(a) f
408 (particula) r(r) 63 1655 y(function) c(which) h(the) e(thr) n(ead) h
409 (should) f(execute) n(.) 36 b(This) 25 b(is) g(like) g(the) g(POSIX) f
410 (\(or) i(any) f(other) n(\)) h(C) 63 1768 y(language) c(interface.) 204
411 1884 y(The) k(second) f(method) h(of) h(use) e(is) i(to) f(cr) n(eate) h
412 (a) g(new) g(class) g(which) g(inherits) f(fr) n(om) p
413 Fd 28 w(omn) n(i_) 63 1997 y(thr) n(ead) p Fg(.) 50 b(In) 31
414 b(this) f(case) g(the) g(thr) n(ead) g(will) i(execute) d(the) p
415 Fd 29 w(run\(\)) p Fg 29 w(member) h(function) h(of) f(the) 63
416 2109 y(new) 22 b(class.) 29 b(One) 23 b(advantage) g(of) g(this) g
417 (scheme) f(is) h(that) g(thr) n(ead-speci\002c) g(data) g(can) h(be) f
418 (imple-) 63 2222 y(mented) e(simply) h(by) h(having) g(data) g(members)
419 f(of) h(the) f(new) g(class.) 204 2339 y(When) f(constr) o(ucted) g(a) i
420 (thr) n(ead) f(is) g(in) h(the) e("new") h(state) f(and) h(has) g(not) g
421 (actuall) r(y) g(starte) n(d.) 28 b(A) 63 2451 y(call) j(to) p
422 Fd 29 w(sta) n(rt\(\)) p Fg 28 w(causes) e(the) g(thr) n(ead) g(to) g
423 (begin) g(executing.) 47 b(A) 29 b(static) h(member) f(function) p
424 Fd 63 2564 a(cre) n(ate\() n(\)) p Fg 32 w(is) j(pr) n(ovided) f(to) g
425 (constr) o(uct) g(and) g(start) g(a) i(thr) n(ead) e(in) h(a) g(single)
426 g(call.) 57 b(A) 31 b(thr) n(ead) 63 2677 y(exits) 21
427 b(by) i(call) r(ing) p Fd 22 w(exit\() n(\)) p Fg 22
428 w(or) g(by) f(r) n(eturning) g(fr) n(om) h(the) f(thr) n(ead) g
429 (function.) 204 2793 y(Thr) n(eads) 27 b(can) j(be) e(either) g
430 (detached) f(or) h(undetached) n(.) 46 b(Detached) 28
431 b(thr) n(eads) g(ar) n(e) h(thr) n(eads) 63 2906 y(for) h(which) i(all)
432 g(state) e(will) i(be) f(lost) f(upon) g(exit.) 52 b(Other) 30
433 b(thr) n(eads) g(cannot) h(dete) n(rmine) g(when) 63
434 3019 y(a) e(detached) f(thr) n(ead) h(will) h(disappear) -7
435 b(,) 31 b(and) e(ther) n(efor) n(e) f(should) g(not) h(attempt) f(to) g
436 (access) h(the) 63 3132 y(thr) n(ead) 23 b(object) g(unless) f(some) h
437 (explicit) h(synchr) n(onisation) f(with) g(the) g(detached) f(thr) n
438 (ead) h(guar) n(-) 63 3245 y(antees) e(that) h(it) h(still) g(exists.)
439 204 3361 y(Undet) n(ached) 33 b(thr) n(eads) f(ar) n(e) i(thr) n(eads) e
440 (for) h(which) g(storage) f(is) h(not) f(r) n(eclai) r(med) g(until) i
441 (an-) 63 3474 y(othe) n(r) g(thr) n(ead) g(waits) g(for) g(its) g
442 (termination) g(by) g(call) r(ing) p Fd 34 w(joi) n(n\(\)) p
443 Fg(.) 61 b(An) 34 b(exit) g(value) h(can) g(be) 63 3587
444 y(passe) n(d) 23 b(fr) n(om) g(an) g(undet) n(ached) g(thr) n(ead) f
445 (to) g(the) g(thr) n(ead) g(which) h(joins) g(it.) 204
446 3703 y(Detached) 31 b(/) h(undetached) e(thr) n(eads) h(ar) n(e) i
447 (distinguish) n(ed) f(on) f(cr) n(eation) h(by) g(the) f(type) g(of) 63
448 3816 y(function) 24 b(they) e(execute.) 30 b(Undetached) 22
449 b(thr) n(eads) h(execute) g(a) h(function) g(which) g(has) g(a) p
450 Fd 25 w(voi) n(d*) p Fg 63 3929 a(r) n(eturn) c(typ) n(e,) h(wher) n
451 (eas) f(detached) f(thr) n(eads) h(execute) f(a) j(function) f(which) g
452 (has) g(a) p Fd 21 w(void) p Fg 19 w(r) n(eturn) 63 4042
453 y(typ) n(e.) 52 b(Unfortunate) n(ly) 31 b(C++) g(member) g(functions) f
454 (ar) n(e) h(not) f(allowed) g(to) g(be) h(distingu) n(ished) 63
455 4155 y(simply) 26 b(by) h(their) f(r) n(eturn) g(type) n(.) 40
456 b(Thus) 26 b(in) h(the) f(case) h(of) g(a) g(derived) f(class) h(of) p
457 Fd 26 w(omni_) n(thre) n(ad) p Fg 63 4268 a(which) 20
458 b(needs) e(an) j(undet) n(ached) f(thr) n(ead,) g(the) f(member) h
459 (function) g(execute) n(d) g(by) g(the) f(thr) n(ead) g(is) 63
460 4380 y(called) p Fd 19 w(run_u) n(ndet) n(ache) n(d\(\)) p
461 Fg 18 w(rather) f(than) p Fd 19 w(run\() n(\)) p Fg(,) h(and) g(it) g
462 (is) g(started) e(by) i(calli) r(ng) p Fd 18 w(star) n(t_) 63
463 4493 y(und) n(etac) n(hed\(\)) p Fg 21 w(instead) j(of) p
464 Fd 22 w(start) n(\(\)) p Fg(.) 204 4610 y(The) i(abstraction) i(curr) n
465 (ently) e(suppo) n(rts) h(thr) n(ee) f(priorities) g(of) h(thr) n(ead,)
466 g(but) g(no) g(guarantee) 63 4722 y(is) 33 b(made) g(of) h(how) f(this)
467 g(will) h(af) n(f) r(ect) f(underlying) f(thr) n(ead) h(scheduling.) 59
468 b(The) 33 b(thr) n(ee) f(priori-) 63 4835 y(ties) 18
469 b(ar) n(e) p Fd 20 w(PRIO) n(RITY) n(_LOW) p Fg(,) p
470 Fd 18 w(PRIO) n(RITY) n(_NOR) n(MAL) p Fg 19 w(and) p
471 Fd 19 w(PRIO) n(RITY) n(_HIG) n(H) p Fg(.) h(By) g(default) g(all) 63
472 4948 y(thr) n(eads) i(r) o(un) i(at) p Fd 23 w(PRIO) n(RITY) n(_NORM) n
473 (AL) p Fg(.) f(A) g(dif) n(fer) n(ent) h(priority) f(can) i(be) e
474 (speci\002ed) g(on) g(thr) n(ead) 63 5061 y(cr) n(eation,) h(or) f
475 (while) h(the) f(thr) n(ead) g(is) h(r) o(unning) g(using) p
476 Fd 22 w(set_) n(prio) n(rity\() n(\).) p Fg 28 w(A) g(thr) n(ead's) f
477 (cur) n(-) 63 5174 y(r) n(ent) g(priority) g(is) g(r) n(eturned) f(by) p
478 Fd 23 w(pri) n(ority) n(\(\)) p Fg(.) 204 5290 y(Other) d(functions) g
479 (pr) n(ovided) g(ar) n(e) p Fd 19 w(sel) n(f\(\)) p Fg
480 18 w(which) h(r) n(eturns) e(the) h(calli) r(ng) g(thr) n(ead's) p
481 Fd 18 w(omn) n(i_) 63 5403 y(thr) n(ead) p Fg 36 w(object,) p
482 Fd 40 w(yie) n(ld\(\)) p Fg 35 w(which) 38 b(r) n(eques) n(ts) e(that) h
483 (other) e(thr) n(eads) h(be) h(allowed) g(to) f(r) o(un,) p
484 90 rotate dyy eop
485 %%Page: 4 4
486 4 3 bop Fg 221 249 a(4) p Fe 1367 w(6) 91 b(THRE) n(ADED) 23
487 b(I/O) g(SHUTDOWN) f(FOR) g(UNIX) p Fd 221 548 a(id\(\)) p
488 Fg 27 w(which) 29 b(r) n(eturns) e(an) i(intege) n(r) g(id) f(for) h
489 (the) e(thr) n(ead) h(for) g(use) g(in) h(debug) n(ging,) p
490 Fd 29 w(state) n(\(\)) p Fg(,) p Fd 221 661 a(slee) n(p\(\)) p
491 Fg 22 w(and) p Fd 22 w(get_t) n(ime\() n(\)) p Fg(.) p
492 Fh 221 953 a(4) 119 b(Per) n(-threa) n(d) 30 b(data) p
493 Fg 221 1164 a(omnithr) n(ead) 22 b(suppo) n(rts) g(per) n(-thr) n(ead) f
494 (data,) h(via) i(member) e(functions) f(of) i(the) p
495 Fd 21 w(omni) n(_thr) n(ead) p Fg 221 1277 a(object.) 362
496 1390 y(First,) d(you) g(must) h(allocate) h(a) f(key) f(for) g(with) h
497 (the) p Fd 20 w(omni) n(_thre) n(ad::) n(allo) n(cate_) n(key\() n(\)) p
498 Fg 221 1502 a(function.) 28 b(Then,) 21 b(any) h(object) g(whose) f
499 (class) h(is) g(derived) f(fr) n(om) p Fd 23 w(omni) n(_thr) n(ead::) n
500 (valu) n(e_t) p Fg 221 1615 a(can) 27 b(be) f(stor) n(e) n(d) g(using) f
501 (the) p Fd 26 w(set) n(_val) n(ue\(\)) p Fg 25 w(function.) 38
502 b(V) -8 b(alues) 25 b(ar) n(e) h(r) n(etrieved) f(or) h(r) n(emoved) 221
503 1728 y(with) p Fd 23 w(get) n(_valu) n(e\(\)) p Fg 21
504 w(and) p Fd 23 w(remo) n(ve_v) n(alue\() n(\)) p Fg 22
505 w(r) n(espectively) -10 b(.) 362 1841 y(When) 23 b(the) g(thr) n(ead) g
506 (exits,) g(all) i(per) n(-thr) n(ead) e(data) h(is) g(delet) n(ed) f
507 (\(hence) h(the) e(base) i(class) g(with) 221 1954 y(virtual) g(dest) n
508 (r) o(uctor\).) 362 2067 y(Note) 17 b(that) i(the) f(per) n(-thr) n
509 (ead) f(data) i(functions) f(ar) n(e) p Fb 19 w(not) p
510 Fg 18 w(thr) n(ead) g(safe,) i(so) d(although) i(you) e(can) 221
511 2180 y(access) 29 b(one) e(thr) n(ead's) h(storage) f(fr) n(om) i
512 (another) f(thr) n(ead,) h(ther) n(e) e(is) i(no) f(concurr) n(ency) g
513 (contr) n(ol.) 221 2293 y(Unless) j(you) g(r) n(eall) r(y) h(know) f
514 (what) h(you) f(ar) n(e) i(doing,) g(it) g(is) f(best) f(to) h(only) g
515 (access) g(per) n(-thr) n(ead) 221 2406 y(data) 23 b(fr) n(om) g(the) f
516 (thr) n(ead) g(it) h(is) g(attached) f(to.) p Fh 221
517 2698 a(5) 119 b(Using) 31 b(OMNI) d(threads) h(in) h(your) g(program) p
518 Fg 221 2909 a(Obvi) r(ously) 16 b(you) h(need) g(to) g(include) h(the) p
519 Fd 16 w(omnit) n(hrea) n(d.h) p Fg 17 w(header) e(\002le) i(in) g(your)
520 f(sour) n(ce) g(code,) 221 3021 y(and) 25 b(link) g(in) h(the) e
521 (omnithr) n(ead) g(libra) r(ry) g(with) h(your) f(execut) n(abl) r(e.)
522 34 b(Because) 23 b(ther) n(e) h(is) h(a) g(single) p
523 Fd 221 3134 a(omni) n(threa) n(d.h) p Fg 30 w(for) 32
524 b(all) h(platforms,) h(certain) e(pr) n(epr) n(oces) n(sor) f
525 (de\002nes) f(must) h(be) g(given) h(as) 221 3247 y(compiler) 25
526 b(options) n(.) 33 b(The) 23 b(easiest) g(way) h(to) g(do) f(this) h
527 (is) g(to) g(stud) n(y) g(the) g(make\002les) f(given) h(in) h(the) 221
528 3360 y(examples) i(pr) n(ovided) g(with) g(this) g(distribution.) 42
529 b(If) 27 b(you) g(ar) n(e) g(to) g(include) h(OMNI) f(thr) n(eads) g
530 (in) 221 3473 y(your) 18 b(own) g(development) g(envir) n(onment,) h
531 (thes) n(e) g(ar) n(e) g(the) f(necessary) g(pr) n(epr) n(oce) n(ssor) g
532 (de\002nes) n(:) p 362 3567 3287 4 v 360 3680 4 113 v
533 412 3646 a(Platform) p 1312 3680 V 599 w(Pr) n(epr) n(ocess) n(or) 23
534 b(De\002nes) p 3648 3680 V 362 3683 3287 4 v 362 3700
535 V 360 3813 4 113 v 412 3779 a(Sun) f(Solaris) h(2.x) p
536 1312 3813 V Fd 365 w(-D__) n(suno) n(s__) 54 b(-D_) n(_spa) n(rc__) f
537 (-D__) n(OSVER) n(SION) n(__=5) p 3648 3813 V 360 3926
538 V 1312 3926 V 1363 3892 a(-DSV) n(R4) h(-DUs) n(ePth) n(read) f(-D_R) n
539 (EENT) n(RANT) p 3648 3926 V 362 3929 3287 4 v 360 4042
540 4 113 v Fg 412 4008 a(x86) 24 b(Linux) e(2.0) p 1312
541 4042 V Fd 418 w(-D__) n(linu) n(x__) 54 b(-D_) n(_i86) n(__) g(-D__) n
542 (OSVE) n(RSION) n(__=2) p 3648 4042 V 360 4155 V Fg 412
543 4121 a(with) 23 b(linuxthr) n(eads) f(0.5) p 1312 4155
544 V Fd 100 w(-D_R) n(EENT) n(RANT) p 3648 4155 V 362 4158
545 3287 4 v 360 4271 4 113 v Fg 412 4237 a(Digital) i(Unix) f(3.2) p
546 1312 4271 V Fd 320 w(-D__) n(osf1) n(__) 54 b(-D__) n(alph) n(a__) g
547 (-D_) n(_OSV) n(ERSIO) n(N__=) n(3) p 3648 4271 V 360
548 4384 V 1312 4384 V 1363 4350 a(-D_R) n(EENT) n(RANT) p
549 3648 4384 V 362 4387 3287 4 v 360 4500 4 113 v Fg 412
550 4466 a(W) -5 b(indows) 22 b(NT) p 1312 4500 V Fd 411
551 w(-D__) n(NT__) 53 b(-MD) p 3648 4500 V 362 4503 3287
552 4 v Fh 221 4740 a(6) 119 b(Threaded) 29 b(I/O) g(shutdown) h(for) g
553 (Unix) p Fg 221 4951 a(or) -7 b(,) 20 b(how) e(one) g(thr) n(ead) h
554 (shou) n(ld) h(tell) f(another) f(thr) n(ead) g(to) h(shut) f(down) g
555 (when) g(it) h(might) g(be) g(doing) 221 5064 y(a) k(blocking) g(cal) r
556 (l) g(on) f(a) h(socket) n(.) p Fb 362 5177 a(If) h(you) e(are) i
557 (using) e(omniOR) n(B,) h(you) e(don') n(t) i(need) g(to) g(worry) f
558 (about) g(all) i(this,) f(since) h(om-) 221 5290 y(niORB) i(does) h(it)
559 h(for) f(you) n(.) p Fg 41 w(This) g(section) f(is) h(only) g(r) n
560 (elevant) g(if) h(you) e(ar) n(e) h(using) f(omnithr) n(ead) 221
561 5403 y(in) d(your) f(own) g(socket) n(-based) h(pr) n(ogramming.) k(It)
562 22 b(is) h(also) g(serious) n(ly) g(out) f(of) h(date.) p
563 90 rotate dyy eop
564 %%Page: 5 5
565 5 4 bop Fe 63 249 a(6.1) 91 b(r) n(ead\(\)) p Fg 2800
566 w(5) 204 548 y(Unfortunate) n(ly) 35 b(ther) n(e) e(doe) n(sn't) h
567 (seem) f(to) h(be) g(a) h(standar) n(d) e(way) i(of) f(doing) f(this) h
568 (which) 63 661 y(works) 19 b(acr) n(oss) i(all) i(Unix) e(syst) n(ems.)
569 27 b(I) 21 b(have) g(investigated) f(the) h(behaviour) g(of) g(Solaris)
570 h(2.5) g(and) 63 774 y(Digital) k(Unix) g(3.2.) 36 b(On) 26
571 b(Digital) h(Unix) e(everyth) n(ing) h(is) f(\002ne,) g(as) h(the) e
572 (obvious) h(method) f(using) 63 887 y(shutd) n(own\(\)) 32
573 b(seems) f(to) h(work) f(OK.) h(Unfortunately) f(on) h(Solaris) h(shut)
574 n(down) f(can) h(only) f(be) 63 1000 y(used) 25 b(on) h(a) h(connected)
575 e(socke) n(t,) i(so) f(we) g(need) f(devious) h(means) g(to) g(get) f
576 (ar) n(ound) h(this) g(lim) r(ita-) 63 1112 y(tion.) h(The) 22
577 b(details) g(ar) n(e) h(summarised) g(below:) p Fc 63
578 1429 a(6.1) 99 b(read\(\)) p Fg 63 1627 a(Thr) n(ead) 28
579 b(A) h(is) g(in) h(a) g(loop,) g(doing) p Fd 28 w(rea) n(d\(soc) n(k\))
580 p Fg(,) g(pr) n(ocess) n(ing) f(the) g(data,) h(then) f(going) f(back)
581 63 1739 y(into) 22 b(the) g(r) n(ead.) 204 1862 y(Thr) n(ead) 30
582 b(B) h(comes) f(along) h(and) g(wants) f(to) g(shut) g(it) h(down) f
583 (\227) h(it) g(can't) g(cancel) h(thr) n(ead) f(A) 63
584 1975 y(since) 21 b(\(i\)) h(working) e(out) g(how) g(to) h(clean) h(up)
585 e(accor) n(ding) i(to) e(wher) n(e) g(A) h(is) g(in) h(its) f(loop) f
586 (is) h(a) h(night-) 63 2088 y(mar) n(e,) h(and) f(\(ii\)) i(this) f
587 (isn't) f(ava) r(ilabl) r(e) g(in) h(omnithr) n(ead) f(anyway) -10
588 b(.) 204 2211 y(On) 23 b(Solaris) g(2.5) g(and) g(Digital) h(Unix) f
589 (3.2) g(the) f(following) h(strate) n(gy) f(works:) 204
590 2334 y(Thr) n(ead) g(B) g(does) p Fd 21 w(shut) n(down\() n(sock) n
591 (,2\)) p Fg(.) 204 2457 y(At) g(this) g(point) h(thr) n(ead) f(A) g(is)
592 h(either) f(blocked) g(inside) p Fd 23 w(rea) n(d\(so) n(ck\)) p
593 Fg(,) g(or) g(is) h(elsewhe) n(r) n(e) g(in) 63 2570
594 y(the) 18 b(loop.) 26 b(If) 18 b(the) g(former) h(then) f(r) n(ead) h
595 (will) h(r) n(eturn) e(0,) i(indicating) f(that) g(the) f(socke) n(t) h
596 (is) g(closed.) 26 b(If) 63 2683 y(the) 21 b(latter) h(then) f
597 (eventually) h(thr) n(ead) g(A) g(will) i(call) p Fd
598 24 w(rea) n(d\(so) n(ck\)) p Fg 21 w(and) f(then) e(this) h(will) h(r) n
599 (eturn) 63 2796 y(0.) 28 b(Thr) n(ead) 22 b(A) h(should) p
600 Fd 21 w(clos) n(e\(soc) n(k\)) p Fg(,) f(do) g(any) g(other) g(tidying)
601 f(up,) h(and) h(exit.) 204 2919 y(If) 34 b(ther) n(e) g(is) h(another) f
602 (point) g(in) h(the) e(loop) i(that) f(thr) n(ead) g(A) h(can) g(block)
603 g(then) f(obviously) 63 3032 y(thr) n(ead) 19 b(B) h(needs) f(to) h(be)
604 g(awar) n(e) h(of) f(this) g(and) g(be) h(able) g(to) e(wake) h(it) h
605 (up) f(in) g(the) g(appr) n(opriate) g(way) 63 3145 y(fr) n(om) j(that)
606 f(point.) p Fc 63 3462 a(6.2) 99 b(accept\(\)) p Fg 63
607 3659 a(Again) 25 b(thr) n(ead) g(A) h(is) f(in) h(a) g(loop,) g(this) f
608 (time) h(doing) e(an) i(acc) r(ept) e(on) h(listenSock,) g(dealing) h
609 (with) 63 3772 y(a) d(new) f(connection) g(and) h(going) e(back) j
610 (into) e(accept.) 28 b(Thr) n(ead) 22 b(B) g(wants) h(to) f(cancel) h
611 (it.) 204 3895 y(On) g(Digital) h(Unix) f(3.2) g(the) f(strateg) n(y) g
612 (is) h(identical) h(to) e(that) g(for) h(r) n(ead:) 204
613 4018 y(Thr) n(ead) 39 b(B) g(does) p Fd 38 w(shut) n(down) n(\(list) n
614 (enSo) n(ck,2) n(\)) p Fg(.) 79 b(Wher) n(ever) 38 b(thr) n(ead) h(A) h
615 (is) f(in) h(the) 63 4131 y(loop,) i(eventually) c(it) h(will) h(r) n
616 (eturn) p Fd 38 w(ECONN) n(ABOR) n(TED) p Fg 38 w(fr) n(om) f(the) f
617 (accept) h(call) r(.) 76 b(It) 39 b(shou) n(ld) p Fd
618 63 4244 a(clo) n(se\(l) n(isten) n(Sock) n(\)) p Fg(,) 22
619 b(tidy) g(up) g(as) h(necessary) e(and) i(exit.) 204
620 4367 y(On) 30 b(Solaris) f(2.5) i(thr) n(ead) e(B) g(can't) h(do) p
621 Fd 29 w(shu) n(tdow) n(n\(lis) n(tenS) n(ock,2) n(\)) p
622 Fg 29 w(\227) g(this) f(r) n(eturns) p Fd 63 4480 a(ENO) n(TCON) n(N) p
623 Fg(.) 22 b(Instead) f(the) h(following) h(strateg) n(y) g(can) g(be) g
624 (used) n(:) 204 4603 y(First) 35 b(thr) n(ead) h(B) g(set) n(s) g(some)
625 f(sort) g(of) h("shutdo) n(wn) g(\003ag") g(associated) g(with) g
626 (listenSock.) 63 4716 y(Then) 31 b(it) h(does) p Fd 30
627 w(gets) n(ocka) n(ddr\(l) n(iste) n(nSock) n(\)) p Fg
628 32 w(to) f(\002nd) g(out) g(which) i(port) e(listenSock) f(is) 63
629 4828 y(on) 18 b(\(or) h(knows) e(alr) n(eady\),) j(sets) d(up) h(a) h
630 (socket) e(dummySock,) i(doe) n(s) p Fd 19 w(con) n(nect) n(\(dumm) n
631 (ySoc) n(k,) 63 4941 y(thi) n(s) 54 b(host,) f(por) n(t\)) p
632 Fg 22 w(and) 23 b(\002nally) g(does) p Fd 21 w(clos) n(e\(dum) n(mySo) n
633 (ck\)) p Fg(.) 204 5064 y(Wher) n(ever) 16 b(thr) n(ead) h(A) g(is) g
634 (in) h(the) e(loop,) h(eventually) g(it) h(will) g(call) p
635 Fd 19 w(acce) n(pt\(li) n(sten) n(Sock) n(\)) p Fg(.) 63
636 5177 y(This) 35 b(will) j(r) n(eturn) d(successfully) g(with) h(a) h
637 (new) e(socket,) j(say) e(connSock.) 67 b(Thr) n(ead) 36
638 b(A) f(then) 63 5290 y(checks) 20 b(to) h(see) f(if) i(the) f("shutd) n
639 (own) g(\003ag") h(is) f(set.) 26 b(If) c(not,) e(then) h(it's) g(a) h
640 (normal) g(connection.) 27 b(If) 21 b(it) 63 5403 y(is) h(set,) g(then)
641 f(thr) n(ead) h(A) h(closes) f(listenSock) f(and) i(connSock,) e
642 (tidies) h(up) g(and) h(exits.) p 90 rotate dyy eop
643 %%Page: 6 6
644 6 5 bop Fg 221 249 a(6) p Fe 1367 w(6) 91 b(THRE) n(ADED) 23
645 b(I/O) g(SHUTDOWN) f(FOR) g(UNIX) p Fc 221 548 a(6.3) 99
646 b(write\(\)) p Fg 221 768 a(Thr) n(ead) 19 b(A) f(may) h(be) g(blocked)
647 f(in) i(write,) f(or) f(about) h(to) f(go) g(in) h(to) g(a) g(poten) n
648 (tiall) r(y-blocking) g(write.) 221 881 y(Thr) n(ead) j(B) h(wants) f
649 (to) g(shut) f(it) i(down.) 362 1016 y(On) g(Solaris) g(2.5:) 362
650 1150 y(Thr) n(ead) f(B) h(doe) n(s) p Fd 23 w(shu) n(tdown) n(\(soc) n
651 (k,2\)) p Fg -2 w(.) 362 1285 y(If) c(thr) n(ead) f(A) h(is) g(alr) n
652 (eady) g(in) p Fd 20 w(wri) n(te\(s) n(ock\)) p Fg 17
653 w(then) f(it) h(will) i(r) n(eturn) d(with) p Fd 18 w(ENXIO) p
654 Fg -2 w(.) h(If) g(thr) n(ead) 221 1398 y(A) k(calls) h(write) e(after)
655 g(thr) n(ead) g(B) h(calls) h(shut) n(down) e(this) g(will) i(r) n
656 (eturn) p Fd 22 w(EIO) p Fg(.) 362 1532 y(On) f(Digital) h(Unix) f
657 (3.2:) 362 1666 y(Thr) n(ead) f(B) h(doe) n(s) p Fd 23
658 w(shu) n(tdown) n(\(soc) n(k,2\)) p Fg -2 w(.) 362 1801
659 y(If) h(thr) n(ead) f(A) g(is) h(alr) n(eady) g(in) p
660 Fd 24 w(writ) n(e\(so) n(ck\)) p Fg 23 w(then) e(it) i(will) h(r) n
661 (eturn) e(the) f(number) i(of) f(bytes) 221 1914 y(written) 31
662 b(befor) n(e) h(it) g(became) g(blocked.) 55 b(A) 32
663 b(subseq) n(uent) f(cal) r(l) h(to) f(write) h(will) h(then) e(gene) n
664 (rate) p Fd 221 2027 a(SIGP) n(IPE) p Fg 22 w(\(or) p
665 Fd 22 w(EPIP) n(E) p Fg 23 w(will) 24 b(be) e(r) n(eturned) f(if) p
666 Fd 24 w(SIG) n(PIPE) p Fg 21 w(is) i(ignor) n(ed) e(by) i(the) f(thr) n
667 (ead\).) p Fc 221 2413 a(6.4) 99 b(connect\(\)) p Fg
668 221 2634 a(Thr) n(ead) 30 b(A) f(may) h(be) g(blocked) f(in) i
669 (connect,) g(or) e(about) h(to) f(go) g(in) i(to) e(a) h(poten) n
670 (tiall) r(y-blocking) 221 2747 y(connect.) d(Thr) n(ead) c(B) f(wants) g
671 (to) g(shut) g(it) g(down.) 362 2881 y(On) h(Digital) h(Unix) f(3.2:)
672 362 3016 y(Thr) n(ead) f(B) h(doe) n(s) p Fd 23 w(shu) n(tdown) n
673 (\(soc) n(k,2\)) p Fg -2 w(.) 362 3150 y(If) j(thr) n(ead) f(A) g(is) h
674 (alr) n(eady) g(in) p Fd 26 w(conn) n(ect\() n(sock) n(\)) p
675 Fg 26 w(then) e(it) i(will) h(r) n(eturn) e(a) h(successful) f(con-) 221
676 3263 y(nection.) 54 b(Subsequ) n(ent) 31 b(r) n(eading) g(or) g
677 (writing) g(will) i(show) d(that) i(the) e(socket) g(has) h(been) g
678 (shut) 221 3376 y(down) 22 b(\(i.e.) 28 b(r) n(ead) 23
679 b(r) n(eturns) e(0,) i(write) f(generate) n(s) p Fd 23
680 w(SIG) n(PIPE) p Fg 21 w(or) g(r) n(eturns) p Fd 22 w(EPI) n(PE) p
681 Fg(\).) g(If) h(thr) n(ead) f(A) 221 3489 y(call) r(s) g(connect) g
682 (after) h(thr) n(ead) f(B) g(call) r(s) g(shutdo) n(wn) h(this) f(will)
683 i(r) n(eturn) p Fd 22 w(EIN) n(VAL) p Fg(.) 362 3623
684 y(On) f(Solaris) g(2.5:) 362 3758 y(Ther) n(e) 35 b(is) h(no) f(way) g
685 (to) g(wake) g(up) g(a) h(thr) n(ead) f(which) h(is) g(blocked) f(in) h
686 (connect.) 66 b(Inst) n(ead) 221 3871 y(Solaris) 33 b(for) n(ces) g(us)
687 f(thr) n(ough) g(a) i(ridiculous) f(pr) n(oced) n(ur) n(e) g(whichever)
688 g(way) g(we) f(try) g(it.) 59 b(One) 221 3984 y(way) 23
689 b(is) f(this:) 362 4118 y(First) d(thr) n(ead) h(A) g(cr) n(eates) f(a)
690 h(pipe) g(in) g(addition) g(to) f(the) g(socket) n(.) 27
691 b(Instead) 19 b(of) h(shut) n(ting) g(down) 221 4231
692 y(the) i(socket) n(,) h(thr) n(ead) f(B) g(simply) h(writes) e(a) i
693 (byte) f(to) g(the) g(pipe.) 362 4365 y(Thr) n(ead) 17
694 b(A) g(meanwhile) h(set) n(s) f(the) g(socke) n(t) g(to) g
695 (non-blocking) g(mode) f(using) p Fd 17 w(fcn) n(tl\(s) n(ock,) 221
696 4478 y(F_SE) n(TFL,) 53 b(O_NO) n(NBLO) n(CK\)) p Fg(.) 26
697 b(Then) h(it) g(cal) r(ls) g(connect) g(on) g(the) f(socket) g(\227) h
698 (this) g(will) i(r) n(eturn) p Fd 221 4591 a(EINP) n(ROGRE) n(SS) p
699 Fg(.) k(Then) h(it) h(must) e(cal) r(l) p Fd 35 w(sel) n(ect\() n(\)) p
700 Fg(,) k(waiting) e(for) f(either) g(sock) g(to) f(become) 221
701 4704 y(writable) 39 b(or) f(for) h(the) e(pipe) h(to) g(become) g(r) n
702 (eadable.) 75 b(If) 39 b(select) e(r) n(eturns) g(that) i(just) e(sock)
703 h(is) 221 4817 y(writable) 30 b(then) f(the) g(connection) g(has) h
704 (succeede) n(d.) 49 b(It) 29 b(then) g(need) n(s) h(to) f(set) f(the) h
705 (socket) f(back) 221 4930 y(to) i(blocking) h(mode) f(using) p
706 Fd 30 w(fcnt) n(l\(so) n(ck,) 54 b(F_S) n(ETFL) n(,) h(0\)) p
707 Fg(.) c(If) 31 b(instead) e(select) h(r) n(eturns) 221
708 5043 y(that) 23 b(the) e(pipe) h(is) h(r) n(eadable,) g(thr) n(ead) f
709 (A) h(closes) e(the) h(socket) n(,) h(tidies) f(up) g(and) h(exits.) 362
710 5177 y(An) g(alternative) h(method) e(is) i(similar) h(but) e(to) g
711 (use) f(polling) i(instead) e(of) i(the) e(pipe.) 29
712 b(Thr) n(ead) 221 5290 y(B) 24 b(justs) e(sets) g(a) j(\003ag) f(and) g
713 (thr) n(ead) f(A) h(calls) h(select) e(with) g(a) i(timeout,) e(period)
714 n(ica) r(lly) h(waking) f(up) 221 5403 y(to) f(see) g(if) h(the) f
715 (\003ag) h(has) f(been) g(set.) p 90 rotate dyy eop
716 %%Page: 7 7
717 7 6 bop Fe 63 249 a(REF) n(ERENCES) p Fg 2660 w(7) p
718 Fh 63 548 a(Refere) n(nces) p Fg 63 759 a([POSIX94]) p
719 Fa 46 w(Portable) 29 b(Operat) r(ing) f(System) g(Interface) h
720 (\(POSIX\)) e(Thr) n(ea) r(ds) h(Extension) p Fg(,) h(P1003) r(.1c) 245
721 872 y(Draft) 23 b(10,) g(IEEE,) e(Septe) n(mber) i(1994) r(.) 63
722 1059 y([Birr) n(ell89]) p Fa 47 w(An) 28 b(Intr) n(od) r(uction) g(to) h
723 (Pr) n(ogr) r(amming) g(with) g(Thr) n(ead) r(s) p Fg(,) h(Rese) n(ar) n
724 (ch) g(Repo) n(rt) e(35,) j(DEC) 245 1172 y(Syst) n(ems) 22
725 b(Resear) n(ch) g(Center) -7 b(,) 22 b(Palo) h(Alto,) f(CA,) h(January)
726 g(1989) r(.) p 90 rotate dyy eop
727 %%Trailer
728 end
729 userdict /end-hook known{end-hook}if
730 %%EOF