File : s-taprop-xi.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- S Y S T E M . T A S K _ P R I M I T I V E S .O P E R A T I O N S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2001-2016, AdaCore --
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. GNARL 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 -- --
19 -- --
20 -- --
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 is the version of this package for Ravenscar bare board targets
33
34 -- This package contains all the GNULL primitives that interface directly with
35 -- the underlying OS.
36
37 pragma Restrictions (No_Elaboration_Code);
38
39 with System.Multiprocessors;
40 with System.Parameters;
41 with System.Tasking;
42 with System.OS_Interface;
43
44 package System.Task_Primitives.Operations is
45 pragma Preelaborate;
46
47 package ST renames System.Tasking;
48 package OSI renames System.OS_Interface;
49
50 Environment_Task : ST.Task_Id := ST.Null_Task;
51 -- Task ID of the environment task
52
53 -- See s-taprop.ads for up to date specs of the following subprograms
54
55 procedure Initialize (Environment_Task : ST.Task_Id);
56 pragma Inline (Initialize);
57 -- Perform initialization and set up of the environment task for proper
58 -- operation of the tasking run-time. This must be called once, before any
59 -- other subprograms of this package are called.
60
61 procedure Create_Task
62 (T : ST.Task_Id;
63 Wrapper : System.Address;
64 Stack_Size : System.Parameters.Size_Type;
65 Priority : ST.Extended_Priority;
66 Base_CPU : System.Multiprocessors.CPU_Range;
67 Succeeded : out Boolean);
68 pragma Inline (Create_Task);
69
70 procedure Enter_Task (Self_ID : ST.Task_Id);
71 pragma Inline (Enter_Task);
72
73 procedure Initialize_TCB (Self_ID : ST.Task_Id; Succeeded : out Boolean);
74 pragma Inline (Initialize_TCB);
75
76 function Self return ST.Task_Id;
77 pragma Inline (Self);
78
79 procedure Set_Priority (T : ST.Task_Id; Prio : ST.Extended_Priority);
80 pragma Inline (Set_Priority);
81
82 function Get_Priority (T : ST.Task_Id) return ST.Extended_Priority;
83 pragma Inline (Get_Priority);
84
85 function Get_Affinity
86 (T : ST.Task_Id) return System.Multiprocessors.CPU_Range;
87
88 function Get_CPU (T : ST.Task_Id) return System.Multiprocessors.CPU;
89
90 function Get_Thread_Id (T : ST.Task_Id) return OSI.Thread_Id;
91 -- Return the thread id of the specified task
92
93 type Time is new System.OS_Interface.Time;
94
95 function Monotonic_Clock return Time;
96 pragma Inline (Monotonic_Clock);
97
98 ----------------
99 -- Extensions --
100 ----------------
101
102 procedure Sleep
103 (Self_ID : ST.Task_Id;
104 Reason : System.Tasking.Task_States);
105 pragma Inline (Sleep);
106 -- The caller should hold no lock when calling this procedure
107
108 procedure Delay_Until (Abs_Time : Time);
109 pragma Inline (Delay_Until);
110
111 procedure Wakeup
112 (T : ST.Task_Id;
113 Reason : System.Tasking.Task_States);
114 pragma Inline (Wakeup);
115 -- The caller should hold no lock when calling this procedure
116
117 function Is_Task_Context return Boolean;
118 pragma Inline (Is_Task_Context);
119 -- This function returns True if the current execution is in the context
120 -- of a task, and False if it is an interrupt context.
121
122 end System.Task_Primitives.Operations;