📄 manual.ps
字号:
b Fn(\);)50 b(x)f(end)361 4939 y Fq(e)o(xcept)24 b(that)gFn(mSwap)e Fq(is)i(e)o(x)o(ecuted)h(atomically)-6 b(.)16905187 y(11)p eop%%Page: 12 1212 11 bop 664 555 a Fl(val)22 b Fk(mSwapEvt:)105 b Fc(\()pFf(\013)21 b Fk(mvar)d(*)i Ff(\013)p Fc(\))26 b Fd(!)fFf(\013)c Fk(event)784 730 y Fn(mSwapEvt)48 b Fb(mv)80b Fq(returns)25 b(an)f(e)n(v)o(ent-v)n(alue)j(that)d(represents)j(the)dFn(mSwap)f Fq(operation)j(on)784 843 y Fb(mv)j Fq(and)24b Fb(newV)10 b Fq(.)664 1018 y Fl(val)22 b Fk(sameMVar:)105b Fc(\()p Ff(\013)21 b Fk(mvar)d(*)i Ff(\013)g Fk(mvar)oFc(\))25 b Fd(!)g Fk(bool)784 1194 y Fn(sameMVar)48 b(\()pFb(mv1)p Fn(,)h Fb(mv2)p Fn(\))88 b Fq(returns)42 b Fn(true)pFq(,)f(if)f Fb(mv1)e Fq(and)i Fb(mv2)e Fq(are)i(the)g(same)g(M-)7841307 y(v)n(ariable.)805 1482 y(I-v)n(ariables)29 b(pro)o(vide)e(a)f(useful)h(mechanism)g(for)f(implementing)i(the)e(reply)h(communi-)6641595 y(cation)c(in)e(request/reply)k(protocols.)30 b(The)o(y)21b(may)g(also)g(be)h(used)g(to)f(implement)h(incremental)6641708 y(data)i(structures)j(and)d(streams.)805 1820 y(A)f(disciplined)j(use)e(of)f(M-v)n(ariables)j(can)d(pro)o(vide)i(an)f(atomic)g(read-modify-write)j(op-)664 1933 y(eration.)k Fp(See)25b(Also:)78 b Fk(CML)21 b Fq(\(3\))2113 5187 y(12)p eop%%Page: 13 1313 12 bop 241 555 a Fr(2.3)119 b(The)30 b Fm(Mailbox)eFr(structur)n(e)241 770 y Fq(The)h Fn(Mailbox)f Fq(structure)33b(pro)o(vides)f(b)n(uf)n(fered)g(asynchronous)i(channels,)g(which)c(we)f(call)241 883 y(mailbox)o(es.)241 1119 y Fp(Synopsis:)3611236 y Fl(signature)18 b Fk(MAILBOX)361 1349 y Fl(structure)73b Fk(Mailbox:)105 b(MAILBOX)241 1586 y Fp(Interface:)3611689 y Fj(type)20 b Fi(\013)h Fn(mbox)361 1789 y Fj(val)fFn(mailbox:)98 b(unit)22 b Fh(!)h Fi(\013)c Fn(mbox)3611889 y Fj(val)h Fn(sameMailbox:)97 b Fg(\()p Fi(\013)19b Fn(mbox)f(*)g Fi(\013)h Fn(mbox)p Fg(\))k Fh(!)g Fn(bool)3611988 y Fj(val)d Fn(send:)99 b Fg(\()p Fi(\013)19 b Fn(mbox)f(*)gFi(\013)p Fg(\))24 b Fh(!)f Fn(unit)361 2088 y Fj(val)dFn(recv:)99 b Fi(\013)19 b Fn(mbox)j Fh(!)h Fi(\013)3612187 y Fj(val)d Fn(recvEvt:)98 b Fi(\013)19 b Fn(mbox)jFh(!)h Fi(\013)c Fn(event)361 2287 y Fj(val)h Fn(recvPoll:)98b Fi(\013)19 b Fn(mbox)j Fh(!)h Fi(\013)c Fn(option)2412524 y Fp(Description:)241 2641 y Fl(type)i Ff(\013)iFk(mbox)361 2827 y Fq(This)d(is)g(the)h(type)g(constructor)i(for)e(a)f(mailbox.)29 b(A)19 b(mailbox)i(is)f(an)h(unbounded,)j(b)n(uf)n(fered)361 2940 y(communication)i(channel.)241 3127 y Fl(val)21b Fk(mailbox:)106 b(unit)23 b Fd(!)i Ff(\013)c Fk(mbox)3613313 y Fn(mailbox)48 b(\(\))72 b Fq(creates)26 b(a)d(ne)n(w)g(mailbox.)241 3500 y Fl(val)e Fk(sameMailbox:)104 b Fc(\()p Ff(\013)21b Fk(mbox)d(*)i Ff(\013)h Fk(mbox)n Fc(\))k Fd(!)h Fk(bool)3613687 y Fn(sameMailbox)48 b(\()p Fb(mb1)o Fn(,)h Fb(mb2)pFn(\))88 b Fq(returns)42 b Fn(true)p Fq(,)g(if)d Fb(mb1)fFq(and)j Fb(mb2)d Fq(are)i(the)g(same)361 3800 y(mailbox.)2413986 y Fl(val)21 b Fk(send:)107 b Fc(\()p Ff(\013)21b Fk(mbox)d(*)i Ff(\013)p Fc(\))26 b Fd(!)f Fk(unit)3614173 y Fn(send)49 b(\()p Fb(mb)q Fn(,)h Fb(msg)t Fn(\))76b Fq(sends)28 b(the)g(message)g Fb(msg)i Fq(to)d(the)g(mailbox)iFb(mb)q Fq(.)39 b(Note)27 b(that)g(un-)361 4286 y(lik)o(e)dFn(CML.send)p Fq(,)d(this)j(is)f(a)g(non-blocking)28b(operation.)241 4472 y Fl(val)21 b Fk(recv:)107 b Ff(\013)21b Fk(mbox)i Fd(!)i Ff(\013)361 4659 y Fn(recv)49 b Fb(mb)81b Fq(recei)n(v)o(e)31 b(the)f(ne)o(xt)h(message)g(from)f(the)g(mailbox)i Fb(mb)q Fq(.)48 b(If,)31 b(the)g(mailbox)g(is)361 4772y(empty)-6 b(,)24 b(then)g(this)g(blocks)h(the)f(calling)h(thread)g(until)f(there)h(is)e(a)g(message)i(a)n(v)n(ailable.)2414959 y Fl(val)c Fk(recvEvt:)106 b Ff(\013)20 b Fk(mbox)kFd(!)h Ff(\013)c Fk(event)1690 5187 y Fq(13)p eop%%Page: 14 1414 13 bop 784 555 a Fn(recvEvt)49 b Fb(mb)83 b Fq(returns)34b(the)f(e)n(v)o(ent)g(v)n(alue)h(that)f(represents)i(the)eFn(recv)e Fq(operation)k(on)784 668 y Fb(mb)r Fq(.)664843 y Fl(val)22 b Fk(recvPoll:)105 b Ff(\013)20 b Fk(mbox)kFd(!)h Ff(\013)c Fk(option)784 1018 y Fq(This)27 b(is)g(the)g(non-blocking)k(v)o(ersion)d(of)f Fn(recv)p Fq(.)38 b(If)26b(the)i(corresponding)j(blocking)e(form)784 1131 y(w)o(ould)c(block)g(\(because)h(the)f(mailbox)g(is)f(empty\),)h(then)g(this)f(returns)iFn(NONE)p Fq(,)d(otherwise)784 1244 y(it)g(returns)jFn(SOME)c Fq(of)h(the)h(recei)n(v)o(ed)h(message.)8051419 y(Note)31 b(that)g(mailbox)h(b)n(uf)n(fers)h(are)e(unbounded,)k(which)d(means)f(that)g(there)h(is)f(no)g(\003o)n(w)6641532 y(control)k(to)f(pre)n(v)o(ent)g(a)f(producer)j(from)e(greatly)h(outstriping)h(a)d(consumer)l(,)38 b(and)c(thus)g(e)o(x-)6641645 y(hausting)29 b(memory)-6 b(.)36 b(In)26 b(situations)j(where)d(there)h(is)f(no)g(natural)i(limit)e(to)g(the)g(rate)h(of)fFn(send)664 1758 y Fq(operations,)31 b(it)c(is)g(recommended)j(that)d(the)h(synchronous)j(channels)e(from)f(the)f Fn(CML)fFq(struc-)664 1871 y(ture)e(be)g(used)g(instead.)31 bFp(See)25 b(Also:)78 b Fk(CML)21 b Fq(\(3\))2113 5187y(14)p eop%%Page: 15 1515 14 bop 241 555 a Fr(2.4)119 b(The)30 b Fm(OS)f Fr(structur)n(e)241762 y Fq(The)21 b Fn(OS)f Fq(structure)k(is)d(a)g(container)j(for)e(a)f(collection)j(of)d(structures)j(for)e(interacting)i(with)d(the)241875 y(operating)26 b(system')-5 b(s)25 b(\002le)e(system,)h(directory)i(paths,)e(processes)i(and)e(I/O)f(subsystem.)241 1108y Fp(Synopsis:)361 1221 y Fl(signature)18 b Fk(CML)p1044 1221 28 4 v 32 w(OS)361 1334 y Fl(structure)73 bFk(OS:)53 b(CML)p 1317 1334 V 31 w(OS)241 1567 y Fp(Interface:)3611666 y Fn(OS)361 1766 y Fj(structure)69 b Fn(Process)48b(:)100 b Fj(sig)661 1866 y Fa(CML)p 846 1866 25 4 v30 w(OS)p 982 1866 V 30 w(PR)m(OCESS)541 2003 y Fj(end)3612102 y(structure)69 b Fn(IO)49 b(:)h Fj(sig)661 2202y Fa(CML)p 846 2202 V 30 w(OS)p 982 2202 V 30 w(IO)5412339 y Fj(end)382 2452 y Fp(See)25 b(Also:)76 b Fk(OS)21b Fq(\()p Fo(??)q Fq(\),)i Fk(OS.FileSys)p Fq(,)17 bFk(OS.Path)p Fq(,)i Fk(OS.Process)e Fq(\()p Fo(??)r Fq(\),)22b Fk(OS.IO)241 2565 y Fq(\()p Fo(??)q Fq(\))1690 5187y(15)p eop%%Page: 16 1616 15 bop 664 555 a Fr(2.5)119 b(The)30 b Fm(OS.Process)eFr(structur)n(e)664 762 y Fq(The)33 b Fn(OS.Process)dFq(structure)36 b(pro)o(vides)f(functions)g(for)e(manipulating)k(processes)e(in)e(an)664 875 y(operating)26 b(system)f(independent)i(manner)-5 b(.)664 1108 y Fp(Synopsis:)784 1221 y Fl(signature)19b Fk(CML)p 1468 1221 28 4 v 31 w(OS)p 1609 1221 V 32w(PROCESS)784 1334 y Fl(structure)73 b Fk(OS.Process:)104b(CML)p 2231 1334 V 32 w(OS)p 2373 1334 V 32 w(PROCESS)6641567 y Fp(Interface:)784 1666 y Fn(OS)p 889 1666 25 4v 30 w(PROCESS)784 1766 y Fj(val)20 b Fn(systemEvt:)98b(string)22 b Fh(!)h Fn(status)f(event)664 1999 y Fp(Description:)6642112 y Fl(val)g Fk(systemEvt:)104 b(string)23 b Fd(!)iFk(status)d(event)495 b Fq(raises)25 b Fk(SysErr)7842287 y Fn(systemEvt)48 b Fb(cmd)79 b Fq(asks)28 b(the)f(operating)i(system)f(to)f(e)o(x)o(ecute)h(the)f(command)g Fb(cmd)iFq(as)784 2400 y(a)24 b(sub-process,)k(and)d(returns)h(an)f(e)n(v)o(ent)g(for)f(synchronizing)29 b(on)c(the)g(termination)h(of)f(the)7842513 y(sub-process.)32 b(Raises)24 b Fn(SysErr)e Fq(if)h(the)h(command)g(cannot)h(be)f(e)o(x)o(ecuted.)904 2626 y(Note)f(that,)g(although)h(this)f(function)i(is)d(independent)k(of)d(the)g(operating)i(system,)e(the)784 2739 y(interpretation)j(of)c(the)g(string)iFb(cmd)g Fq(depends)g(v)o(ery)e(much)g(on)g(the)h(underlying)i(operating)784 2852 y(system)f(and)g(shell.)805 3027y Fp(See)i(Also:)77 b Fk(OS)22 b Fq(\(15\),)i Fk(OS.Process)18b Fq(\()p Fo(??)r Fq(\))2113 5187 y(16)p eop%%Page: 17 1717 16 bop 241 555 a Fr(2.6)119 b(The)30 b Fm(OS.IO)eFr(structur)n(e)241 762 y Fq(The)19 b Fn(OS.IO)e Fq(structure)22b(pro)o(vides)f(a)e(general)i(interf)o(ace)g(for)f(polling)h(I/O)d(de)n(vices,)k(which)d(has)241 875 y(been)24 b(modelled)g(after)g(the)g(Unix)f(SVR4)f(poll)h(interf)o(ace.)31 b(A)22 b Fn(poll)p2391 875 25 4 v 29 w(desc)p Fq(,)g(created)j(from)e(an)241988 y(I/O)g(descriptor)l(,)j(can)e(be)f(used)i(to)e(test)h(for)g(v)n(arious)h(polling)g(conditions.)241 1221 y Fp(Synopsis:)3611334 y Fl(signature)18 b Fk(CML)p 1044 1334 28 4 v 32w(OS)p 1186 1334 V 32 w(IO)361 1447 y Fl(structure)73b Fk(OS.IO:)52 b(CML)p 1481 1447 V 31 w(OS)p 1622 1447V 32 w(IO)241 1680 y Fp(Interface:)361 1779 y Fn(OS)p466 1779 25 4 v 29 w(IO)361 1879 y Fj(val)20 b Fn(pollEvt:)98b(poll)p 1234 1879 V 29 w(desc)23 b(list)f Fh(!)h Fn(poll)p2014 1879 V 29 w(info)f(list)h(event)241 2112 y Fp(Description:)2412225 y Fl(val)16 b Fk(pollEvt:)105 b(poll)p 1192 222528 4 v 31 w(desc)23 b(list)h Fd(!)h Fk(poll)p 2046 2225V 31 w(info)e(list)h(event)88 b Fq(raises)25 b Fk(OS.SysErr)3612400 y Fn(pollEvt)48 b Fb(l)78 b Fq(polls)30 b(a)e(list)h(of)g(poll)h(descriptors)i Fb(l)o Fq(.)44 b(This)29 b(will)f(raise)iFn(OS.SysErr)c Fq(if,)361 2513 y(for)d(e)o(xample,)i(one)f(of)f(the)h(\002le)f(descriptors)j(refers)f(to)e(a)h(closed)h(\002le.)3822688 y Fp(See)h(Also:)77 b Fk(OS)22 b Fq(\(15\),)i Fk(OS.IO)cFq(\()p Fo(??)q Fq(\))1690 5187 y(17)p eop%%Page: 18 1818 17 bop 2113 5187 a Fq(18)p eop%%Page: 19 1919 18 bop 241 1178 a Ft(Chapter)44 b(3)241 1593 y Fs(CML)51b(Library)h(Refer)l(ence)241 2075 y Fr(3.1)119 b(The)30b Fm(Multicast)d Fr(structur)n(e)241 2283 y Fq(Multicast)35b(channels)g(pro)o(vide)g(a)e(mechanism)h(for)g(broadcasting)j(a)32b(stream)i(of)f(messages)241 2396 y(to)26 b(a)h(collection)i(of)e(threads.)39 b(Threads)28 b(recei)n(v)o(e)g(multicast)g(messages)g(via)f(an)g Fe(output)h(port)r Fq(;)241 2509 y(each)g(port)f(recei)n(v)o(es)i(its)e(o)n(wn)f(cop)o(y)i(of)f(e)n(v)o(ery)h(message)g(sent)g(since)g(the)f(port)h(w)o(as)e(created.)241 2621 y(Multicast)k(channels)h(are)e(particularly)j(useful)f(for)e(communicating)i(with)e(a)f(dynamically)241 2734 y(v)n(arying)21 b(group)g(of)e(threads,)j(since)e(the)g(sender)h(does)g(not)e(need)i(to)e(kno)n(w)h(ho)n(w)f(man)o(y)g(threads)241 2847 y(are)k(listening.)241 3080 y Fp(Synopsis:)3613194 y Fl(signature)18 b Fk(MULTICAST)361 3306 y Fl(structure)73b Fk(Multicast:)104 b(MULTICAST)241 3540 y Fp(Interface:)3613639 y Fj(type)20 b Fi(\013)h Fn(event)p Fa(=)f Fi(\013)eFn(CML)p Fi(:)p Fn(event)361 3739 y Fj(type)i Fi(\013)hFn(mchan)361 3839 y Fj(type)f Fi(\013)h Fn(port)361 3938y Fj(val)f Fn(mChannel:)98 b(unit)22 b Fh(!)h Fi(\013)cFn(mchan)361 4038 y Fj(val)h Fn(port:)99 b Fi(\013)19b Fn(mchan)j Fh(!)h Fi(\013)c Fn(port)361 4138 y Fj(val)hFn(copy:)99 b Fi(\013)19 b Fn(port)j Fh(!)h Fi(\013)cFn(port)361 4237 y Fj(val)h Fn(recv:)99 b Fi(\013)19b Fn(port)j Fh(!)h Fi(\013)361 4337 y Fj(val)d Fn(recvEvt:)98b Fi(\013)19 b Fn(port)j Fh(!)h Fi(\013)c Fn(event)3614436 y Fj(val)h Fn(multicast:)98 b Fg(\()p Fi(\013)19b Fn(mchan)e(*)i Fi(\013)p Fg(\))k Fh(!)g Fn(unit)2414670 y Fp(Description:)241 4783 y Fl(type)e Ff(\013)iFk(mchan)361 4959 y Fq(This)g(is)g(the)h(type)h(constructor)h(for)e(asynchronous)k(multicast)d(channels.)1690 5187 y(19)peop%%Page: 20 2020 19 bop 664 555 a Fl(type)21 b Ff(\013)i Fk(port)784730 y Fq(This)e(is)f(the)h(type)g(constructor)j(for)d(output)h(ports)g(on)f(an)f(asynchronous)25 b(multicast)d(chan-)784 843y(nels.)664 1018 y Fl(val)g Fk(mChannel:)105 b(unit)23b Fd(!)i Ff(\013)c Fk(mchan)784 1194 y Fn(mChannel)48b Fb(\(\))73 b Fq(creates)25 b(a)e(ne)n(w)g(multicast)i(channel.)6641369 y Fl(val)d Fk(port:)106 b Ff(\013)21 b Fk(mchan)iFd(!)i Ff(\013)c Fk(port)784 1544 y Fn(port)49 b Fb(mc)70b Fq(creates)23 b(a)d(ne)n(w)g(output)j(port)e(on)g(the)g(channel)iFb(mc)p Fq(.)k(The)20 b(port)i(recei)n(v)o(es)g(those)7841657 y(messages)j(sent)f(after)h(it)e(is)g(created.)6641832 y Fl(val)f Fk(copy:)106 b Ff(\013)21 b Fk(port)iFd(!)j Ff(\013)20 b Fk(port)784 2007 y Fn(copy)49 b Fb(p)75b Fq(creates)28 b(a)d(ne)n(w)g(output)j(port)e(on)g(a)g(channel)i(that)e(has)g(the)g(same)g(state)h(as)f(the)784 2120 y(port)cFb(p)q Fq(.)27 b(I.e.,)21 b(the)h(stream)g(of)g(messages)h(seen)g(on)e(the)h(tw)o(o)g(ports)g(will)g(be)f(the)h(same.)28 b(This)7842233 y(is)h(useful)i(when)e(tw)o(o)g(threads)i(need)f(to)f(see)h(the)f(same)h(stream)f(of)h(messages.)47 b(NO)l(TE:)784 2346y(if)27 b(tw)o(o)f(\(or)h(more\))g(independent)j(threads)f(are)e(reading)h(from)f Fb(p)f Fq(at)h(the)g(time)f(that)iFn(copy)784 2459 y Fq(operation)e(is)e(performed,)h(then)f(it)f(may)h(not)f(be)h(accurate.)664 2634 y Fl(val)e Fk(recv:)106b Ff(\013)21 b Fk(port)i Fd(!)j Ff(\013)784 2809 y Fn(recv)49b Fb(p)75 b Fq(gets)26 b(the)f(ne)o(xt)h(message)h(from)e(the)h(port)gFb(p)p Fq(.)33 b(The)25 b(calling)i(thread)g(is)e(block)o(ed)7842922 y(until)g(there)f(is)f(a)h(message)g(a)n(v)n(ailable.)6643097 y Fl(val)e Fk(recvEvt:)105 b Ff(\013)21 b Fk(port)iFd(!)i Ff(\013)c Fk(event)784 3273 y Fn(recvEvt)49 bFb(p)75 b Fq(creates)29 b(an)d(e)n(v)o(ent)h(v)n(alue)h(that)f(represents)i(the)e Fn(recv)e Fq(operation)k(on)e(the)7843385 y(port)d Fb(p)q Fq(.)664 3561 y Fl(val)e Fk(multicast:)104b Fc(\()p Ff(\013)21 b Fk(mchan)d(*)i Ff(\013)p Fc(\))26b Fd(!)f Fk(unit)784 3736 y Fn(multicast)48 b(\()p Fb(mc)pFn(,)i Fb(v)7 b Fn(\))80 b Fq(multicasts)34 b(the)e(v)n(alue)hFb(v)k Fq(on)32 b(the)g(channel)i Fb(mc)p Fq(.)53 b(This)32b(is)g(a)784 3849 y(nonblocking)27 b(operation.)21135187 y
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -