annotate gcc/ada/libgnarl/s-taspri__vxworks.ads @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- S Y S T E M . T A S K _ P R I M I T I V E S --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 2001-2017, Free Software Foundation, Inc. --
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNARL is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNARL was developed by the GNARL team at Florida State University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This is a VxWorks version of this package
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 pragma Polling (Off);
kono
parents:
diff changeset
35 -- Turn off polling, we do not want ATC polling to take place during tasking
kono
parents:
diff changeset
36 -- operations. It causes infinite loops and other problems.
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 with System.OS_Interface;
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 package System.Task_Primitives is
kono
parents:
diff changeset
41 pragma Preelaborate;
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 type Lock is limited private;
kono
parents:
diff changeset
44 -- Should be used for implementation of protected objects
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 type RTS_Lock is limited private;
kono
parents:
diff changeset
47 -- Should be used inside the runtime system. The difference between Lock
kono
parents:
diff changeset
48 -- and the RTS_Lock is that the later one serves only as a semaphore so
kono
parents:
diff changeset
49 -- that do not check for ceiling violations.
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 type Suspension_Object is limited private;
kono
parents:
diff changeset
52 -- Should be used for the implementation of Ada.Synchronous_Task_Control
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 type Task_Body_Access is access procedure;
kono
parents:
diff changeset
55 -- Pointer to the task body's entry point (or possibly a wrapper
kono
parents:
diff changeset
56 -- declared local to the GNARL).
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 type Private_Data is limited private;
kono
parents:
diff changeset
59 -- Any information that the GNULLI needs maintained on a per-task basis.
kono
parents:
diff changeset
60 -- A component of this type is guaranteed to be included in the
kono
parents:
diff changeset
61 -- Ada_Task_Control_Block.
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 subtype Task_Address is System.Address;
kono
parents:
diff changeset
64 Task_Address_Size : constant := Standard'Address_Size;
kono
parents:
diff changeset
65 -- Type used for task addresses and its size
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 Alternate_Stack_Size : constant := 0;
kono
parents:
diff changeset
68 -- No alternate signal stack is used on this platform
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 private
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 type Priority_Type is (Prio_None, Prio_Protect, Prio_Inherit);
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 type Lock is record
kono
parents:
diff changeset
75 Mutex : System.OS_Interface.SEM_ID;
kono
parents:
diff changeset
76 Protocol : Priority_Type;
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 Prio_Ceiling : System.OS_Interface.int;
kono
parents:
diff changeset
79 -- Priority ceiling of lock
kono
parents:
diff changeset
80 end record;
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 type RTS_Lock is new Lock;
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 type Suspension_Object is record
kono
parents:
diff changeset
85 State : Boolean;
kono
parents:
diff changeset
86 pragma Atomic (State);
kono
parents:
diff changeset
87 -- Boolean that indicates whether the object is open. This field is
kono
parents:
diff changeset
88 -- marked Atomic to ensure that we can read its value without locking
kono
parents:
diff changeset
89 -- the access to the Suspension_Object.
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 Waiting : Boolean;
kono
parents:
diff changeset
92 -- Flag showing if there is a task already suspended on this object
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 L : aliased System.OS_Interface.SEM_ID;
kono
parents:
diff changeset
95 -- Protection for ensuring mutual exclusion on the Suspension_Object
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 CV : aliased System.OS_Interface.SEM_ID;
kono
parents:
diff changeset
98 -- Condition variable used to queue threads until condition is signaled
kono
parents:
diff changeset
99 end record;
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 type Private_Data is limited record
kono
parents:
diff changeset
102 Thread : aliased System.OS_Interface.t_id := 0;
kono
parents:
diff changeset
103 pragma Atomic (Thread);
kono
parents:
diff changeset
104 -- Thread field may be updated by two different threads of control.
kono
parents:
diff changeset
105 -- (See, Enter_Task and Create_Task in s-taprop.adb).
kono
parents:
diff changeset
106 -- They put the same value (thr_self value). We do not want to
kono
parents:
diff changeset
107 -- use lock on those operations and the only thing we have to
kono
parents:
diff changeset
108 -- make sure is that they are updated in atomic fashion.
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 LWP : aliased System.OS_Interface.t_id := 0;
kono
parents:
diff changeset
111 -- The purpose of this field is to provide a better tasking support on
kono
parents:
diff changeset
112 -- gdb. The order of the two first fields (Thread and LWP) is important.
kono
parents:
diff changeset
113 -- On targets where lwp is not relevant, this is equivalent to Thread.
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 CV : aliased System.OS_Interface.SEM_ID;
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 L : aliased RTS_Lock;
kono
parents:
diff changeset
118 -- Protection for all components is lock L
kono
parents:
diff changeset
119 end record;
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 end System.Task_Primitives;