]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ada/libgnat/s-osprim.ads
[Ada] Bump copyright year
[thirdparty/gcc.git] / gcc / ada / libgnat / s-osprim.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- S Y S T E M . O S _ P R I M I T I V E S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1998-2020, Free Software Foundation, Inc. --
10 -- --
11 -- GNARL is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
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/>. --
26 -- --
27 -- GNARL was developed by the GNARL team at Florida State University. --
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 -- This package provides low level primitives used to implement clock and
33 -- delays in non tasking applications.
34
35 -- The choice of the real clock/delay implementation (depending on whether
36 -- tasking is involved or not) is done via soft links (see s-soflin.ads)
37
38 -- NEVER add any dependency to tasking packages here
39
40 package System.OS_Primitives is
41 pragma Preelaborate;
42
43 Max_Sensible_Delay : constant Duration :=
44 Duration'Min (183 * 24 * 60 * 60.0,
45 Duration'Last);
46 -- Max of half a year delay, needed to prevent exceptions for large delay
47 -- values. It seems unlikely that any test will notice this restriction,
48 -- except in the case of applications setting the clock at run time (see
49 -- s-tastim.adb). Also note that a larger value might cause problems (e.g
50 -- overflow, or more likely OS limitation in the primitives used). In the
51 -- case where half a year is too long (which occurs in high integrity mode
52 -- with 32-bit words, and possibly on some specific ports of GNAT),
53 -- Duration'Last is used instead.
54
55 Max_System_Delay : constant Duration := Max_Sensible_Delay;
56 -- If the Max_System_Delay is larger it doesn't matter. Setting it equal
57 -- allows optimization of code in some targets delay functions.
58
59 procedure Initialize;
60 -- Initialize global settings related to this package. This procedure
61 -- should be called before any other subprograms in this package. Note
62 -- that this procedure can be called several times.
63
64 function Clock return Duration;
65 pragma Inline (Clock);
66 -- Returns "absolute" time, represented as an offset relative to "the
67 -- Epoch", which is Jan 1, 1970 00:00:00 UTC on UNIX systems. This
68 -- implementation is affected by system's clock changes.
69
70 Relative : constant := 0;
71 Absolute_Calendar : constant := 1;
72 Absolute_RT : constant := 2;
73 -- Values for Mode call below. Note that the compiler (exp_ch9.adb) relies
74 -- on these values. So any change here must be reflected in corresponding
75 -- changes in the compiler.
76
77 procedure Timed_Delay (Time : Duration; Mode : Integer);
78 -- Implements the semantics of the delay statement when no tasking is used
79 -- in the application.
80 --
81 -- Mode is one of the three values above
82 --
83 -- Time is a relative or absolute duration value, depending on Mode.
84 --
85 -- Note that currently Ada.Real_Time always uses the tasking run time,
86 -- so this procedure should never be called with Mode set to Absolute_RT.
87 -- This may change in future or bare board implementations.
88
89 end System.OS_Primitives;