28.01.2015 Views

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12011.8.ProcessCreation<strong>and</strong>CommunicationOperations first:integer, second:integer,<br />

sampleinport:inportofsampleinterface )constant(first) exitfinit(first),init(second),init(fourth)g minimumfinit(first),init(second)g exceptionFailurefinit(first),init(second),init(third),negative(first)g; third:integer,<br />

finit(first),init(second),init(third)g; fourth:integer<br />

dierent|parametersfirst,second,<strong>and</strong>thirdwillbeinitialized,<strong>and</strong> <strong>and</strong>returneduninitialized.ThetypestatesfortheexceptionFailureare initializedonnormalexit.Parameterthirdisatransferredparameter| entry<strong>and</strong>exit,<strong>and</strong>guaranteedconstant.Parametersecondisaninout ownedbythecallerbeforethecall,butretainedbythecalledprocess rameterfourthisanoutparameter|uninitializedonentry,butreturned parameter|initializedonentry<strong>and</strong>exit,butnotguaranteedconstant.Pa-<br />

Inthisexample,parameterfirstisaninparameter|initializedon sampleoutport:outportofsampleinport;<br />

acallmessagetospecifyatypestatewhichisnothigherthanorequalto parameterfirstwillbeknowntobenegative. theminimumtypestate.Similarlyallexit<strong>and</strong>exceptiontypestatemustbe higherthanorequaltotheminimumtypestate. Newsimple{statement Itisillegalfortheentrytypestateofaninportwhosemessagetypeis<br />

Thenewoperationinitializesaninputportvariabletoanemptyqueuewith noconnections.Thepreviousvalueoftheinputportvariableisdiscarded. Empty secondary::=emptyofsecondary ::=newvariable{name<br />

Theemptyofoperationreturnsatruebooleanvalueifthequeueisempty, ofoperationonlytondtheinportnolongerempty.However,sinceonly otherwiseitreturnsfalse.Theoper<strong>and</strong>mustbeaninitializedinport. emptyisnotastableproperty;aprocessmayrepeatasuccessfulempty theprocessowninganinputportcanreceivemessages,beingnon-emptyis astableproperty. Sinceotherprocessesmayenqueuemessagesatarbitrarytimes,being

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!