libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / m2 / gm2-libs-coroutines / TimerHandler.def
bloba1176cb5d0efa6afe4a221e1ae4ae9519ad1ff7e
1 (* TimerHandler.def provides a simple timer handler for the 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 TimerHandler ;
29 (* It also provides the Executive with a basic round robin scheduler. *)
31 EXPORT QUALIFIED TicksPerSecond, GetTicks,
32 EVENT,
33 Sleep, ArmEvent, WaitOn, Cancel, ReArmEvent ;
36 CONST
37 TicksPerSecond = 25 ; (* Number of ticks per second. *)
39 TYPE
40 EVENT ;
44 GetTicks - returns the number of ticks since boottime.
47 PROCEDURE GetTicks () : CARDINAL ;
51 Sleep - suspends the current process for a time, t.
52 The time is measured in ticks.
55 PROCEDURE Sleep (t: CARDINAL) ;
59 ArmEvent - initializes an event, e, to occur at time, t.
60 The time, t, is measured in ticks.
61 The event is NOT placed onto the event queue.
64 PROCEDURE ArmEvent (t: CARDINAL) : EVENT ;
68 WaitOn - places event, e, onto the event queue and then the calling
69 process suspends. It is resumed up by either the event
70 expiring or the event, e, being cancelled.
71 TRUE is returned if the event was cancelled
72 FALSE is returned if the event expires.
73 The event, e, is always assigned to NIL when the function
74 finishes.
77 PROCEDURE WaitOn (VAR e: EVENT) : BOOLEAN ;
81 Cancel - cancels the event, e, on the event queue and makes
82 the appropriate process runnable again.
83 TRUE is returned if the event was cancelled and
84 FALSE is returned is the event was not found or
85 no process was waiting on this event.
88 PROCEDURE Cancel (e: EVENT) : BOOLEAN ;
92 ReArmEvent - removes an event, e, from the event queue. A new time
93 is given to this event and it is then re-inserted onto the
94 event queue in the correct place.
95 TRUE is returned if this occurred
96 FALSE is returned if the event was not found.
99 PROCEDURE ReArmEvent (e: EVENT; t: CARDINAL) : BOOLEAN ;
102 END TimerHandler.