3 Module: Communicating Sequential Processes
4 From: "A Modula-2 Implementation of CSP",
5 M. Collado, R. Morales, J.J. Moreno,
6 SIGPlan Notices, Volume 22, Number 6, June 1987.
7 Version: $Id: CSP.def,v 1.3 1994/06/24 12:48:22 ceriel Exp $
9 See this article for an explanation of the use of this module.
12 FROM SYSTEM IMPORT BYTE;
17 (* Beginning of a COBEGIN .. COEND structure *)
20 (* End of a COBEGIN .. COEND structure *)
22 PROCEDURE StartProcess(P: PROC);
23 (* Start an anonimous process that executes the procedure P *)
25 PROCEDURE StopProcess;
26 (* Terminate a Process (itself) *)
28 PROCEDURE InitChannel(VAR ch: Channel);
29 (* Initialize the channel ch *)
31 PROCEDURE GetChannel(ch: Channel);
32 (* Assign the channel ch to the process that gets it *)
34 PROCEDURE Send(data: ARRAY OF BYTE; VAR ch: Channel);
35 (* Send a message with the data to the cvhannel ch *)
37 PROCEDURE Receive(VAR ch: Channel; VAR dest: ARRAY OF BYTE);
38 (* Receive a message from the channel ch into the dest variable *)
40 PROCEDURE SELECT(n: CARDINAL);
41 (* Beginning of a SELECT structure with n guards *)
43 PROCEDURE NEXTGUARD(): CARDINAL;
44 (* Returns an index to the next guard to be evaluated in a SELECT *)
46 PROCEDURE GUARD(cond: BOOLEAN; ch: Channel;
47 VAR dest: ARRAY OF BYTE): BOOLEAN;
48 (* Evaluates a guard, including reception management *)
50 PROCEDURE ENDSELECT(): BOOLEAN;
51 (* End of a SELECT structure *)