⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 manual.ps

📁 这是我们参加06年全国开源软件的竞赛作品
💻 PS
📖 第 1 页 / 共 5 页
字号:
(actions,)c(such)g(as)e(sending)i(a)361 1007 y(request)d(to)e(a)h(serv)o(er)-5 b(.)241 1174 y Fl(val)21 b Fk(withNack:)105 bFc(\()p Fk(unit)24 b(event)f Fd(!)i Ff(\013)c Fk(event)mFc(\))26 b Fd(!)f Ff(\013)c Fk(event)361 1342 y Fn(withNack)48b Fb(f)78 b Fq(creates)25 b Fe(delayed)j Fq(e)n(v)o(ent)d(v)n(alue)f(from)g(the)g(function)i Fb(f)5 b Fq(.)29 b(As)23 b(in)h(the)g(case)3611455 y(of)i Fn(guard)p Fq(,)f(the)h(function)i Fb(f)jFq(will)25 b(be)i(e)n(v)n(aluated)h(at)e(synchronization)31b(time)26 b(and)g(the)h(re-)361 1568 y(sulting)21 b(e)n(v)o(ent)e(v)n(alue)h(will)f(be)g(used)h(in)f(its)h(place)g(in)f(the)g(synchronization.)32 b(Furthermore,)361 1681 y(when)23b Fb(f)28 b Fq(is)c(e)n(v)n(aluated,)h(it)e(is)h(passed)h(a)eFe(ne)l(gative)j(ac)n(knowledg)o(ement)j Fq(e)n(v)o(ent)24b(as)g(an)f(ar)n(gu-)361 1794 y(ment.)35 b(If)25 b(the)h(e)n(v)o(ent)g(v)n(alue)g(that)g(is)g(returned)i(from)d(the)h(e)n(v)n(aluation)i(of)dFb(f)30 b Fq(is)c Fe(not)h Fq(chosen)361 1907 y(in)c(the)g(synchronization,)28 b(then)c(the)f(ne)o(gati)n(v)o(e)h(e)n(v)o(ent)g(will)f(be)g(enabled.)30 b(This)23 b(pro)o(vides)i(a)3612020 y(mechanism)g(for)e(informing)j(serv)o(ers)e(that)h(a)e(client)h(has)g(aborted)i(a)d(transaction.)241 2187 y Fl(val)eFk(choose:)106 b Ff(\013)21 b Fk(event)i(list)g Fd(!)iFf(\013)c Fk(event)361 2355 y Fn(choose)48 b Fb(l)67b Fq(constructs)21 b(an)d(e)n(v)o(ent)h(v)n(alue)g(that)f(represents)j(the)e(non-deterministic)j(choice)361 2468 y(of)h(the)h(e)n(v)o(ents)g(in)g(the)g(list)g Fb(l)o Fq(.)241 2635 y Fl(val)d Fk(sync:)107b Ff(\013)21 b Fk(event)i Fd(!)i Ff(\013)361 2803 y Fn(sync)49b Fb(ev)79 b Fq(synchronizes)27 b(the)d(calling)h(thread)g(on)f(the)f(e)n(v)o(ent)h Fb(ev)7 b Fq(.)241 2970 y Fl(val)21 bFk(select:)106 b Ff(\013)21 b Fk(event)i(list)g Fd(!)iFf(\013)361 3138 y Fn(select)48 b Fb(evs)84 b Fq(synchronizes)38b(on)d(the)g(choice)h(of)f(a)g(list)g(of)f(e)n(v)o(ent)i(v)n(alues.)63b(This)35 b(is)361 3251 y(semantically)26 b(equi)n(v)n(alant)g(to:)11253363 y Fn(sync)49 b(\(choose)148 b Fb(evs)o Fn(\))3613489 y Fq(b)n(ut)24 b(is)f(more)h(ef)n(\002cient.)2413657 y Fl(val)d Fk(never:)106 b Ff(\013)21 b Fk(event)3613824 y Fn(never)69 b Fq(is)21 b(an)g(e)n(v)o(ent)g(v)n(alue)h(that)f(is)g(ne)n(v)o(er)h(enabled)h(for)e(synchronization.)32b(It)21 b(is)g(seman-)361 3937 y(tically)k(equi)n(v)n(alant)h(to)d(the)h(e)o(xpression:)1125 4050 y Fn(choose)48 b([])241 4230y Fl(val)21 b Fk(alwaysEvt:)105 b Ff(\013)25 b Fd(!)hFf(\013)20 b Fk(event)361 4398 y Fn(alwaysEvt)48 b Fb(a)74b Fq(creates)27 b(an)f(e)n(v)o(ent)g(v)n(alue)g(that)g(is)f(al)o(w)o(ays)i(enabled,)g(and)f(that)g(returns)361 4511 y(the)e(v)n(alue)gFb(a)e Fq(upon)j(synchronization.)241 4678 y Fl(val)cFk(timeOutEvt:)104 b(Time)n Ff(:)p Fk(time)24 b Fd(!)hFk(unit)f(event)361 4846 y Fn(timeOutEvt)48 b Fb(t)70b Fq(creates)23 b(an)e(e)n(v)o(ent)g(v)n(alue)h(that)g(becomes)h(enabled)g(at)e(the)g(time)g(inter)n(-)361 4959 y(v)n(al)iFb(t)g Fq(after)h(synchronization.)34 b(F)o(or)22 b(e)o(xample,)i(the)g(e)o(xpression:)1712 5187 y(7)p eop%%Page: 8 88 7 bop 1548 555 a Fn(sync)49 b(\(timeOutEvt)f(\(Time.fromSeconds)e(1\)\))784 685 y Fq(will)19 b(delay)h(the)g(calling)h(thread)f(for)g(one)f(second.)29 b(Note)20 b(that)f(the)h(speci\002ed)g(time)g(interv)n(al)784 798 y(is)k(actually)h(a)e(minimum)h(w)o(aiting)g(time,)f(and)h(the)g(delay)h(may)e(be)g(longer)-5 b(.)664 973 y Fl(val)22b Fk(atTimeEvt:)104 b(Time)n Ff(:)p Fk(time)24 b Fd(!)hFk(unit)f(event)784 1148 y Fn(atTimeEvt)48 b Fb(t)81b Fq(creates)33 b(an)e(e)n(v)o(ent)i(v)n(alue)f(that)g(becomes)h(enabled)g(at)f(the)g(speci\002ed)784 1261 y(time)24b Fb(t)o Fq(.)k(F)o(or)23 b(e)o(xample,)h(the)g(e)o(xpression:)15481377 y Fn(sync)49 b(\(atTimeEvt)f(\(Date.toTime)g(\(Date.date)g({)17471477 y(year)h(=)h(2000,)f(month)g(=)g(Date.Jan,)f(day)i(=)f(0,)17471576 y(hour)g(=)h(0,)f(minute)g(=)h(0,)f(second)g(=)g(0,)17471676 y(offset)g(=)h(NONE)1648 1776 y(}\)\)\))784 1905y Fq(blocks)25 b(the)f(calling)h(thread)g(until)g(the)e(be)o(ginning)j(of)e(the)g(year)g(2000.)805 2080 y Fp(See)i(Also:)77b Fk(Option)p Fq(,)20 b Fk(Time)2136 5187 y Fq(8)p eop%%Page: 9 99 8 bop 241 555 a Fr(2.2)119 b(The)30 b Fm(SyncVar)eFr(structur)n(e)241 768 y Fq(The)19 b Fn(SyncVar)e Fq(structure)22b(pro)o(vides)f Fo(Id)p Fq(-style)f(synchronous)j(v)n(ariables)f(\(or)d(memory)h(cells\).)241 881 y(These)h(v)n(ariables)i(ha)n(v)o(e)e(tw)o(o)g(states:)29 b Fe(empty)21 b Fq(and)g Fe(full)p Fq(.)28b(An)20 b(attempt)i(to)f(read)g(a)f(v)n(alue)i(from)f(an)241994 y(empty)h(v)n(ariable)h(blocks)f(the)g(calling)h(thread)g(until)f(there)g(is)f(a)g(v)n(alue)h(a)n(v)n(ailable.)30 b(An)21b(attempt)241 1106 y(to)26 b(put)h(a)f(v)n(alue)h(into)g(a)f(v)n(ariable)i(that)f(is)f(full)h(results)h(in)e(the)h Fn(Put)eFq(e)o(xception)j(being)g(raised.)241 1219 y(There)33b(are)g(tw)o(o)f(kinds)i(of)e(synchronous)37 b(v)n(ariables:)50b(I-v)n(ariables)35 b(are)e(write-once,)k(while)241 1332y(M-v)n(ariables)25 b(are)f(mutable.)241 1568 y Fp(Synopsis:)3611684 y Fl(signature)18 b Fk(SYNC)p 1099 1684 28 4 v 31w(VAR)361 1797 y Fl(structure)73 b Fk(SyncVar:)105 b(SYNC)p1699 1797 V 31 w(VAR)241 2032 y Fp(Interface:)361 2135y Fj(exception)19 b Fn(Put)361 2234 y Fj(type)h Fi(\013)hFn(ivar)361 2334 y Fj(val)f Fn(iVar:)99 b(unit)22 b Fh(!)hFi(\013)c Fn(ivar)361 2434 y Fj(val)h Fn(iPut:)99 b Fg(\()pFi(\013)19 b Fn(ivar)f(*)g Fi(\013)p Fg(\))24 b Fh(!)fFn(unit)361 2533 y Fj(val)d Fn(iGet:)99 b Fi(\013)19b Fn(ivar)j Fh(!)h Fi(\013)361 2633 y Fj(val)d Fn(iGetEvt:)98b Fi(\013)19 b Fn(ivar)j Fh(!)h Fi(\013)c Fn(event)3612732 y Fj(val)h Fn(iGetPoll:)98 b Fi(\013)19 b Fn(ivar)jFh(!)h Fi(\013)c Fn(option)361 2832 y Fj(val)h Fn(sameIVar:)98b Fg(\()p Fi(\013)19 b Fn(ivar)f(*)g Fi(\013)h Fn(ivar)oFg(\))k Fh(!)h Fn(bool)361 2932 y Fj(type)c Fi(\013)hFn(mvar)361 3031 y Fj(val)f Fn(mVar:)99 b(unit)22 b Fh(!)hFi(\013)c Fn(mvar)361 3131 y Fj(val)h Fn(mVarInit:)98b Fi(\013)23 b Fh(!)g Fi(\013)c Fn(mvar)361 3231 y Fj(val)hFn(mPut:)99 b Fg(\()p Fi(\013)19 b Fn(mvar)f(*)g Fi(\013)pFg(\))24 b Fh(!)f Fn(unit)361 3330 y Fj(val)d Fn(mTake:)98b Fi(\013)19 b Fn(mvar)k Fh(!)g Fi(\013)361 3430 y Fj(val)dFn(mTakeEvt:)98 b Fi(\013)19 b Fn(mvar)j Fh(!)h Fi(\013)cFn(event)361 3530 y Fj(val)h Fn(mGet:)99 b Fi(\013)19b Fn(mvar)j Fh(!)h Fi(\013)361 3629 y Fj(val)d Fn(mGetEvt:)98b Fi(\013)19 b Fn(mvar)j Fh(!)h Fi(\013)c Fn(event)3613729 y Fj(val)h Fn(mTakePoll:)98 b Fi(\013)19 b Fn(mvar)jFh(!)h Fi(\013)c Fn(option)361 3828 y Fj(val)h Fn(mGetPoll:)98b Fi(\013)19 b Fn(mvar)j Fh(!)h Fi(\013)c Fn(option)3613928 y Fj(val)h Fn(mSwap:)98 b Fg(\()p Fi(\013)20 b Fn(mvar)d(*)iFi(\013)p Fg(\))k Fh(!)g Fi(\013)361 4028 y Fj(val)dFn(mSwapEvt:)98 b Fg(\()p Fi(\013)19 b Fn(mvar)f(*)gFi(\013)p Fg(\))24 b Fh(!)f Fi(\013)c Fn(event)361 4127y Fj(val)h Fn(sameMVar:)98 b Fg(\()p Fi(\013)19 b Fn(mvar)f(*)gFi(\013)h Fn(mvar)o Fg(\))k Fh(!)h Fn(bool)241 4363 yFp(Description:)241 4479 y Fl(exception)18 b Fk(Put)3614662 y Fq(This)j(e)o(xception)j(is)d(raised)i(when)e(an)h(attempt)g(is)f(made)h(to)f(put)h(a)f(v)n(alue)h(into)g(a)f(v)n(alue)h(that)3614775 y(is)h(already)i(full)f(\(see)g Fn(iPut)e Fq(and)iFn(mPut)p Fq(\).)241 4959 y Fl(type)d Ff(\013)i Fk(ivar)17125187 y Fq(9)p eop%%Page: 10 1010 9 bop 784 555 a Fq(This)35 b(is)h(the)f(type)i(constructor)h(for)e(I-structured)j(v)n(ariables.)66 b(I-structured)39 b(v)n(ariables)784668 y(are)24 b(write-once)i(v)n(ariables)g(that)f(pro)o(vide)h(synchronization)j(on)24 b(read)g(operations.)34 b(The)o(y)784781 y(are)c(especially)i(useful)e(for)g(one-shot)h(communications,)j(such)c(as)f(reply)h(messages)h(in)784 894 y(client/serv)o(er)c(protocols.)664 1073 y Fl(val)22 b Fk(iVar:)106 b(unit)24b Fd(!)h Ff(\013)c Fk(ivar)784 1253 y Fn(iVar)49 b(\(\))72b Fq(creates)25 b(a)f(ne)n(w)e(empty)i(I-v)n(ariable.)6641432 y Fl(val)e Fk(iPut:)106 b Fc(\()p Ff(\013)21 b Fk(ivar)e(*)hFf(\013)p Fc(\))26 b Fd(!)f Fk(unit)1145 b Fq(raises)24b Fk(Put)784 1611 y Fn(iPut)49 b(\()p Fb(iv)6 b Fn(,)50b Fb(x)t Fn(\))74 b Fq(\002lls)24 b(the)h(I-v)n(ariable)iFb(iv)k Fq(with)24 b(the)h(v)n(alue)h Fb(x)t Fq(.)32b(An)o(y)24 b(threads)j(that)e(are)784 1724 y(block)o(ed)32b(on)d Fb(iv)35 b Fq(will)29 b(be)g(resumed.)48 b(If)29b Fb(iv)35 b Fq(already)c(has)e(a)g(v)n(alue)h(in)g(it,)g(then)g(the)gFn(Put)784 1837 y Fq(e)o(xception)c(is)d(raised.)6642016 y Fl(val)f Fk(iGet:)106 b Ff(\013)21 b Fk(ivar)iFd(!)j Ff(\013)784 2196 y Fn(iGet)49 b Fb(iv)85 b Fq(returns)31b(the)f(contents)i(of)e(the)g(I-v)n(ariable)h Fb(iv)7b Fq(.)46 b(If)29 b(the)h(v)n(ariable)h(is)f(empty)-6b(,)784 2309 y(then)24 b(the)g(calling)h(thread)g(blocks)g(until)g(the)f(v)n(ariable)h(becomes)g(full.)664 2488 y Fl(val)d Fk(iGetEvt:)105b Ff(\013)21 b Fk(ivar)i Fd(!)i Ff(\013)c Fk(event)7842667 y Fn(iGetEvt)49 b Fb(iv)90 b Fq(returns)37 b(an)e(e)n(v)o(ent-v)n(alue)i(that)f(represents)i(the)d Fn(iGet)e Fq(operation)38b(on)784 2780 y Fb(iv)7 b Fq(.)664 2960 y Fl(val)22 bFk(iGetPoll:)105 b Ff(\013)20 b Fk(ivar)k Fd(!)h Ff(\013)cFk(option)784 3139 y Fq(This)32 b(is)h(a)f(non-blocking)k(v)o(ersion)e(of)e Fn(iGet)p Fq(.)54 b(If)32 b(the)h(corresponding)j(blocking)f(form)784 3252 y(w)o(ould)30 b(block,)h(then)f(it)f(returns)hFn(NONE)p Fq(;)e(otherwise)j(it)d(returns)j Fn(SOME)dFq(of)g(the)i(v)n(ariable')-5 b(s)784 3365 y(contents.)6643544 y Fl(val)22 b Fk(sameIVar:)105 b Fc(\()p Ff(\013)21b Fk(ivar)d(*)i Ff(\013)g Fk(ivar)o Fc(\))25 b Fd(!)gFk(bool)784 3723 y Fn(sameIVar)48 b(\()p Fb(iv1)p Fn(,)hFb(iv2)p Fn(\))79 b Fq(returns)33 b Fn(true)p Fq(,)e(if)f(the)hFb(iv1)f Fq(and)h Fb(iv2)f Fq(are)h(the)g(same)f(I-)7843836 y(v)n(ariable.)664 4016 y Fl(type)21 b Ff(\013)iFk(mvar)784 4195 y Fq(This)e(is)g(the)g(type)h(constructor)j(for)c(M-structured)j(v)n(ariables.)30 b(Unlik)o(e)22 b Fn(ivar)dFq(v)n(alues,)k(M-)784 4308 y(structured)28 b(v)n(ariables)f(may)d(be)h(updated)i(multiple)f(times.)33 b(Lik)o(e)25 b(I-v)n(ariables,)j(ho)n(we)n(v)o(er)l(,)784 4421 y(the)o(y)c(may)f(only)i(be)e(written)i(if)e(the)o(y)h(are)f(empty)-6 b(.)664 4600 y Fl(val)22 bFk(mVar:)106 b(unit)24 b Fd(!)h Ff(\013)c Fk(mvar)7844779 y Fn(mVar)49 b(\(\))72 b Fq(creates)25 b(a)f(ne)n(w)e(empty)i(M-v)n(ariable.)664 4959 y Fl(val)e Fk(mVarInit:)105 b Ff(\013)25b Fd(!)g Ff(\013)c Fk(mvar)2113 5187 y Fq(10)p eop%%Page: 11 1111 10 bop 361 555 a Fn(mVar)49 b(x)72 b Fq(creates)25b(a)e(ne)n(w)g(M-v)n(ariable)j(initialized)g(to)d Fb(x)5b Fq(.)241 736 y Fl(val)21 b Fk(mPut:)107 b Fc(\()p Ff(\013)21b Fk(mvar)d(*)i Ff(\013)p Fc(\))26 b Fd(!)f Fk(unit)1145b Fq(raises)25 b Fk(Put)361 917 y Fn(mPut)49 b(\()p Fb(mv)6b Fn(,)50 b Fb(x)t Fn(\))80 b Fq(\002lls)31 b(the)h(M-v)n(ariable)hFb(mv)j Fq(with)31 b(the)h(v)n(alue)g Fb(x)t Fq(.)52b(An)o(y)30 b(threads)j(that)361 1030 y(are)22 b(block)o(ed)i(on)eFb(mv)27 b Fq(will)21 b(be)h(resumed.)30 b(If)21 b Fb(mv)27b Fq(already)d(has)e(a)g(v)n(alue)g(in)g(it,)f(then)i(the)fFn(Put)361 1142 y Fq(e)o(xception)k(is)d(raised.)2411323 y Fl(val)e Fk(mTake:)106 b Ff(\013)21 b Fk(mvar)jFd(!)h Ff(\013)361 1504 y Fn(mTake)49 b Fb(mv)82 b Fq(remo)o(v)o(es)28b(and)g(returns)h(the)f(contents)h(of)f(the)g(M-v)n(ariable)hFb(mv)k Fq(making)28 b(it)361 1617 y(empty)-6 b(.)35b(If)26 b(the)g(v)n(ariable)h(is)f(already)h(empty)-6b(,)27 b(then)f(the)g(calling)h(thread)h(is)d(block)o(ed)j(until)3611730 y(a)23 b(v)n(alue)h(is)g(a)n(v)n(ailable.)241 1910y Fl(val)d Fk(mTakeEvt:)105 b Ff(\013)21 b Fk(mvar)iFd(!)i Ff(\013)c Fk(event)361 2091 y Fn(mTakeEvt)48 bFb(mv)79 b Fq(returns)26 b(an)e(e)n(v)o(ent-v)n(alue)i(that)f(represents)i(the)d Fn(mTake)e Fq(operation)27 b(on)3612204 y Fb(mv)6 b Fq(.)241 2385 y Fl(val)21 b Fk(mGet:)107b Ff(\013)21 b Fk(mvar)i Fd(!)i Ff(\013)361 2565 y Fn(mGet)49b Fb(mv)74 b Fq(returns)21 b(the)e(contents)i(of)e(the)h(M-v)n(ariable)h Fb(mv)j Fq(without)c(emptying)h(the)e(v)n(ari-)3612678 y(able;)24 b(if)e(the)h(v)n(ariable)h(is)f(empty)-6b(,)23 b(then)g(the)g(thread)h(blocks)g(until)f(a)g(v)n(alue)g(is)f(a)n(v)n(ailable.)31 b(It)361 2791 y(is)23 b(equi)n(v)n(alent)j(to)d(the)h(code:)527 2909 y Fn(let)49 b(val)g(x)h(=)g(mTake)148b Fb(mv)56 b Fn(in)50 b(mPut\()98 b Fb(mv)7 b Fn(,)49b(x\);)h(x)f(end)241 3109 y Fl(val)21 b Fk(mGetEvt:)106b Ff(\013)20 b Fk(mvar)k Fd(!)h Ff(\013)c Fk(event)3613289 y Fn(mGetEvt)48 b Fb(mv)91 b Fq(returns)36 b(an)f(e)n(v)o(ent-v)n(alue)j(that)d(represents)j(the)e Fn(mGet)d Fq(operation)38b(on)361 3402 y Fb(mv)6 b Fq(.)241 3583 y Fl(val)21 bFk(mTakePoll:)105 b Ff(\013)20 b Fk(mvar)k Fd(!)h Ff(\013)cFk(option)241 3696 y Fl(val)g Fk(mGetPoll:)105 b Ff(\013)21b Fk(mvar)i Fd(!)i Ff(\013)c Fk(option)361 3876 y Fq(These)j(are)h(non-blocking)j(v)o(ersions)e(of)e Fn(mTake)e Fq(and)jFn(mGet)e Fq(\(respecti)n(v)o(ely\).)34 b(If)24 b(the)g(cor)n(-)3613989 y(responding)29 b(blocking)g(form)d(w)o(ould)h(block,)i(then)e(the)o(y)f(return)i Fn(NONE)p Fq(;)d(otherwise)j(the)o(y)3614102 y(return)d Fn(SOME)d Fq(of)h(the)h(v)n(ariable')-5b(s)26 b(contents.)241 4283 y Fl(val)21 b Fk(mSwap:)106b Fc(\()p Ff(\013)22 b Fk(mvar)c(*)i Ff(\013)p Fc(\))26b Fd(!)f Ff(\013)361 4464 y Fn(mSwap)49 b(\()p Fb(mv)6b Fn(,)49 b Fb(newV)10 b Fn(\))69 b Fq(puts)21 b(the)f(v)n(alue)hFb(newV)29 b Fq(into)21 b(the)g(M-v)n(ariable)h Fb(mv)jFq(and)c(returns)361 4577 y(the)31 b(pre)n(vious)i(contents.)53b(If)31 b(the)g(v)n(ariable)i(is)e(empty)-6 b(,)33 b(then)f(the)f(thread)i(blocks)f(until)g(a)361 4690 y(v)n(alue)24 b(is)f(a)n(v)n(ailable.)31 b(It)24 b(is)f(equi)n(v)n(alent)j(to)d(the)h(code:)5274808 y Fn(let)49 b(val)g(x)h(=)g(mTake)148 b Fb(mv)56b Fn(in)50 b(mPut\()98 b Fb(mv)7 b Fn(,)149 b Fb(newV)9

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -