Syntax:
SENDTO(< | <pointer>, | A | B |>| FIRST | LAST |>, <destination list(s)>);This instruction is used to send messages to one or more lists of messages.
<destination list>
is a list of names of nodes or lists (they
may be of the form EL_<node>
or IL_<node>
)
Message in process is sent to all these destinations (if the list has more than one element, copies are sent at each destination). If one destination is indicated by a node, it is assumed that it must be sent to the EL of the node.
The place in the destination list in which the message is put, depends on the first parameter:
<pointer>, B
the message is put before
the pointed message.<pointer>, A
the message is put after the
pointed message.When SENDTO is executed, the values in the field variables are passed to the fields of the message and this is put in the indicated place.
If this instruction is within an
<associated instruction>
of a GLIDER
instruction, then the values in the O_<fields>
are passed to
the message (except for the CREATE in which the field
variables are used).
In the case the SENDTO is in an <associated instruction>
, the
sent message is:
<associated
instruction>
of the GLIDER instructions indicated
above, such as in the RELEASE instruction.The nodes referred to in the SENDTO instruction must be explicitly indicated in the list of successors, unless there are only one successor and it is implicitly defined as such by being the following in the program.
If the successor is a multiple node, the user have three alternatives to send a message to its ELs:
SPMamp
<Length& SPMamp
of the EL> +& SPMamp
<quantity of& SPMamp
used resource>&
is the minimum. That means the less engaged node of the array.Mail (D) :: SENDTO(Director, Secretary, File);Copies of the message received at
Mail
are sent to the nodes
Director
, Secretary
, and File
.Discrim (G) Queue :: IF Class = Friend THEN SENDTO(FIRST, Queue) ELSE SENDTO(LAST, Queue);
Parkman (G) Parkinglot[INO] :: SENDTO(Parkinglot[MIN]); Parkinglot (R) Street :: STAY := GAMMA(Tpark, DevTpark);
Ii :: IT := 1; Pr := UNIFI(1, 4); OrdQueue (G) LINE :: IF LineGate = Closed THEN BEGIN SCAN(EL_Line, Poin) IF Pr > O_Pr THEN STOPSCAN; IF Poin < > NIL THEN SENDTO(Poin, B, Line) ELSE SENDTO(LAST,Line); END ELSE SENDTO(Line); Line (G) :: STATE BEGIN IF LineGate = Closed THEN LineGate := Open ELSE LineGate := Closed; IT := 8 END; IF LineGate = Open THEN SENDTO(Process); INIT TSIM := 100; ACT(Ii, 0); LineGate := Open; ACT(Line, 8); DECL TYPE Opcl = (Closed, Open); VAR LineGate: Opcl; Poin: POINTER; MESSAGES Ii(Pr: INTEGER); END.Messages, with priorities from 1 to 4 in the field
Pr
, arrive
at OrdQueue
and they are passed to Line
if the variable LineGate
has the value Open
.
In this case, they continue to Process
.
LineGate
is Open
and Closed
each 8 time units.
If LineGate
is closed, then when a message reaches
OrdQueue
, a scan process of the EL of Line
starts.
If a message in the EL is found
with priority less than the incoming message, then this is put before
of that in the EL. So, the EL is always ordered in decreasing order
of priority. In this system the entities that arrive when the gate is
open are allowed to pass, when they have to wait, they are sorted
according to their priority.
This type of sorting may be more easily done using a type L node.