Pristine Ack-5.5
[Ack-5.5.git] / lang / m2 / libm2 / Processes.def
1 DEFINITION MODULE Processes;
2 (*
3   Module:       Processes
4   From:         "Programming in Modula-2", 3rd, corrected edition, by N. Wirth
5   Version:      $Id: Processes.def,v 1.4 1994/06/24 12:49:15 ceriel Exp $
6 *)
7 (*
8   As discussed in "Unfair Process Scheduling in Modula-2", by
9   D. Hemmendinger, SIGplan Notices Volume 23 nr 3, march 1988,
10   the scheduler in this module is unfair, in that in some circumstances
11   ready-to-run processes never get a turn.
12 *)
13
14         TYPE SIGNAL;
15
16         PROCEDURE StartProcess(P: PROC; n: CARDINAL);
17         (* Start a concurrent process with program "P" and workspace of
18            size "n"
19         *)
20
21         PROCEDURE SEND(VAR s: SIGNAL);
22         (* One process waiting for "s" is resumed
23         *)
24
25         PROCEDURE WAIT(VAR s: SIGNAL);
26         (* Wait for some other process to send "s"
27         *)
28
29         PROCEDURE Awaited(s: SIGNAL): BOOLEAN;
30         (* Return TRUE if at least one process is waiting for sinal "s".
31         *)
32
33         PROCEDURE Init(VAR s: SIGNAL);
34         (* Compulsory initialization
35         *)
36 END Processes.