Debian Codegraph @

gcc/ada/libgnarl/s-taspri__vxworks.ads

raw
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 --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2001-2025, 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 is a VxWorks version of this package
33
34 with System.OS_Interface;
35 with System.OS_Locks;
36
37 package System.Task_Primitives is
38 pragma Preelaborate;
39
40 type Lock is limited private;
41 -- Should be used for implementation of protected objects
42
43 type Suspension_Object is limited private;
44 -- Should be used for the implementation of Ada.Synchronous_Task_Control
45
46 type Task_Body_Access is access procedure;
47 -- Pointer to the task body's entry point (or possibly a wrapper
48 -- declared local to the GNARL).
49
50 type Private_Data is limited private;
51 -- Any information that the GNULLI needs maintained on a per-task basis.
52 -- A component of this type is guaranteed to be included in the
53 -- Ada_Task_Control_Block.
54
55 subtype Task_Address is System.Address;
56 Task_Address_Size : constant := Standard'Address_Size;
57 -- Type used for task addresses and its size
58
59 Alternate_Stack_Size : constant := 0;
60 -- No alternate signal stack is used on this platform
61
62 private
63
64 type Lock is new System.OS_Locks.RTS_Lock;
65
66 type Suspension_Object is record
67 State : Boolean;
68 pragma Atomic (State);
69 -- Boolean that indicates whether the object is open. This field is
70 -- marked Atomic to ensure that we can read its value without locking
71 -- the access to the Suspension_Object.
72
73 Waiting : Boolean;
74 -- Flag showing if there is a task already suspended on this object
75
76 L : aliased System.OS_Interface.SEM_ID;
77 -- Protection for ensuring mutual exclusion on the Suspension_Object
78
79 CV : aliased System.OS_Interface.SEM_ID;
80 -- Condition variable used to queue threads until condition is signaled
81 end record;
82
83 type Private_Data is limited record
84 Thread : aliased System.OS_Interface.t_id := 0;
85 pragma Atomic (Thread);
86 -- Thread field may be updated by two different threads of control.
87 -- (See, Enter_Task and Create_Task in s-taprop.adb).
88 -- They put the same value (thr_self value). We do not want to
89 -- use lock on those operations and the only thing we have to
90 -- make sure is that they are updated in atomic fashion.
91
92 LWP : aliased System.OS_Interface.t_id := 0;
93 -- The purpose of this field is to provide a better tasking support on
94 -- gdb. The order of the two first fields (Thread and LWP) is important.
95 -- On targets where lwp is not relevant, this is equivalent to Thread.
96
97 CV : aliased System.OS_Interface.SEM_ID;
98 -- Condition variable used to queue threads until condition is signaled
99
100 L : aliased System.OS_Locks.RTS_Lock;
101 -- Protection for all components is lock L
102 end record;
103
104 end System.Task_Primitives;