annotate gcc/ada/libgnarl/s-taspri__hpux-dce.ads @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
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 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1991-2019, Free Software Foundation, Inc. --
111
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 HP-UX version of this package
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 -- This package provides low-level support for most tasking features
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 pragma Polling (Off);
kono
parents:
diff changeset
37 -- Turn off polling, we do not want ATC polling to take place during tasking
kono
parents:
diff changeset
38 -- operations. It causes infinite loops and other problems.
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 with System.OS_Interface;
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 package System.Task_Primitives is
kono
parents:
diff changeset
43 pragma Preelaborate;
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 type Lock is limited private;
kono
parents:
diff changeset
46 -- Should be used for implementation of protected objects
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 type RTS_Lock is limited private;
kono
parents:
diff changeset
49 -- Should be used inside the runtime system. The difference between Lock
kono
parents:
diff changeset
50 -- and the RTS_Lock is that the later one serves only as a semaphore so
kono
parents:
diff changeset
51 -- that do not check for ceiling violations.
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 type Suspension_Object is limited private;
kono
parents:
diff changeset
54 -- Should be used for the implementation of Ada.Synchronous_Task_Control
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 type Task_Body_Access is access procedure;
kono
parents:
diff changeset
57 -- Pointer to the task body's entry point (or possibly a wrapper
kono
parents:
diff changeset
58 -- declared local to the GNARL).
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 type Private_Data is limited private;
kono
parents:
diff changeset
61 -- Any information that the GNULLI needs maintained on a per-task basis.
kono
parents:
diff changeset
62 -- A component of this type is guaranteed to be included in the
kono
parents:
diff changeset
63 -- Ada_Task_Control_Block.
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 subtype Task_Address is System.Address;
kono
parents:
diff changeset
66 Task_Address_Size : constant := Standard'Address_Size;
kono
parents:
diff changeset
67 -- Type used for task addresses and its size
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 Alternate_Stack_Size : constant := 0;
kono
parents:
diff changeset
70 -- No alternate signal stack is used on this platform
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 private
kono
parents:
diff changeset
73 type Lock is record
kono
parents:
diff changeset
74 L : aliased System.OS_Interface.pthread_mutex_t;
kono
parents:
diff changeset
75 Priority : Integer;
kono
parents:
diff changeset
76 Owner_Priority : Integer;
kono
parents:
diff changeset
77 end record;
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 type RTS_Lock is new System.OS_Interface.pthread_mutex_t;
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 type Suspension_Object is record
kono
parents:
diff changeset
82 State : Boolean;
kono
parents:
diff changeset
83 pragma Atomic (State);
kono
parents:
diff changeset
84 -- Boolean that indicates whether the object is open. This field is
kono
parents:
diff changeset
85 -- marked Atomic to ensure that we can read its value without locking
kono
parents:
diff changeset
86 -- the access to the Suspension_Object.
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 Waiting : Boolean;
kono
parents:
diff changeset
89 -- Flag showing if there is a task already suspended on this object
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 L : aliased System.OS_Interface.pthread_mutex_t;
kono
parents:
diff changeset
92 -- Protection for ensuring mutual exclusion on the Suspension_Object
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 CV : aliased System.OS_Interface.pthread_cond_t;
kono
parents:
diff changeset
95 -- Condition variable used to queue threads until condition is signaled
kono
parents:
diff changeset
96 end record;
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 type Private_Data is record
kono
parents:
diff changeset
99 Thread : aliased System.OS_Interface.pthread_t;
kono
parents:
diff changeset
100 -- pragma Atomic (Thread);
kono
parents:
diff changeset
101 -- Unfortunately, the above fails because Thread is 64 bits.
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 -- Thread field may be updated by two different threads of control.
kono
parents:
diff changeset
104 -- (See, Enter_Task and Create_Task in s-taprop.adb). They put the
kono
parents:
diff changeset
105 -- same value (thr_self value). We do not want to use lock on those
kono
parents:
diff changeset
106 -- operations and the only thing we have to make sure is that they
kono
parents:
diff changeset
107 -- are updated in atomic fashion.
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 CV : aliased System.OS_Interface.pthread_cond_t;
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 L : aliased RTS_Lock;
kono
parents:
diff changeset
112 -- Protection for all components is lock L
kono
parents:
diff changeset
113 end record;
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 end System.Task_Primitives;