libstdc++: Remove std::__unicode::__null_sentinel
[official-gcc.git] / gcc / m2 / gm2-libs-coroutines / Executive.def
blobb2838227c747e3d5f50fdd2688a3fd333f11192e
1 (* Executive.def provides a simple multitasking executive.
3 Copyright (C) 2002-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. *)
27 DEFINITION MODULE Executive ;
29 EXPORT QUALIFIED SEMAPHORE, DESCRIPTOR,
30 InitProcess, KillProcess, Resume, Suspend, InitSemaphore,
31 Wait, Signal, WaitForIO, Ps, GetCurrentProcess,
32 RotateRunQueue, ProcessName, DebugProcess ;
34 TYPE
35 SEMAPHORE ; (* defines Dijkstra's semaphores *)
36 DESCRIPTOR ; (* handle onto a process *)
40 InitProcess - initializes a process which is held in the suspended
41 state. When the process is resumed it will start executing
42 procedure, p. The process has a maximum stack size of,
43 StackSize, bytes and its textual name is, Name.
44 The StackSize should be at least 5000 bytes.
47 PROCEDURE InitProcess (p: PROC; StackSize: CARDINAL;
48 Name: ARRAY OF CHAR) : DESCRIPTOR ;
52 KillProcess - kills the current process. Notice that if InitProcess
53 is called again, it might reuse the DESCRIPTOR of the
54 killed process. It is the responsibility of the caller
55 to ensure all other processes understand this process
56 is different.
59 PROCEDURE KillProcess ;
63 Resume - resumes a suspended process. If all is successful then the process, p,
64 is returned. If it fails then NIL is returned.
67 PROCEDURE Resume (d: DESCRIPTOR) : DESCRIPTOR ;
71 Suspend - suspend the calling process.
72 The process can only continue running if another process
73 Resumes it.
76 PROCEDURE Suspend ;
80 InitSemaphore - creates a semaphore whose initial value is, v, and
81 whose name is, Name.
84 PROCEDURE InitSemaphore (v: CARDINAL; Name: ARRAY OF CHAR) : SEMAPHORE ;
88 Wait - performs dijkstra's P operation on a semaphore.
89 A process which calls this procedure will
90 wait until the value of the semaphore is > 0
91 and then it will decrement this value.
94 PROCEDURE Wait (s: SEMAPHORE) ;
98 Signal - performs dijkstra's V operation on a semaphore.
99 A process which calls the procedure will increment
100 the semaphores value.
103 PROCEDURE Signal (s: SEMAPHORE) ;
107 WaitForIO - waits for an interrupt to occur on vector, VectorNo.
110 PROCEDURE WaitForIO (VectorNo: CARDINAL) ;
114 Ps - displays a process list together with process status.
117 PROCEDURE Ps ;
121 GetCurrentProcess - returns the descriptor of the current running
122 process.
125 PROCEDURE GetCurrentProcess () : DESCRIPTOR ;
129 RotateRunQueue - rotates the process run queue.
130 It does not call the scheduler.
133 PROCEDURE RotateRunQueue ;
137 ProcessName - displays the name of process, d, through
138 DebugString.
141 PROCEDURE ProcessName (d: DESCRIPTOR) ;
145 DebugProcess - gdb debug handle to enable users to debug deadlocked
146 semaphore processes.
149 PROCEDURE DebugProcess (d: DESCRIPTOR) ;
152 END Executive.