* dwarf2out.c (loc_descriptor_from_tree, case CONSTRUCTOR): New case.
[official-gcc.git] / gcc / ada / s-taasde.ads
blob76a9dff90375540969785539949da70b48a52c12
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- S Y S T E M . T A S K I N G . A S Y N C _ D E L A Y S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1998-2001 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNARL; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNARL was developed by the GNARL team at Florida State University. It is --
30 -- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
31 -- State University (http://www.gnat.com). --
32 -- --
33 ------------------------------------------------------------------------------
35 -- This package contains the procedures to implements timeouts (delays)
36 -- for asynchronous select statements.
38 -- Note: the compiler generates direct calls to this interface, via Rtsfind.
39 -- Any changes to this interface may require corresponding compiler changes.
41 package System.Tasking.Async_Delays is
43 -- Suppose the following source code is given:
45 -- select delay When;
46 -- ...continuation for timeout case...
47 -- then abort
48 -- ...abortable part...
49 -- end select;
51 -- The compiler should expand this to the following:
53 -- declare
54 -- DB : aliased Delay_Block;
55 -- begin
56 -- if System.Tasking.Async_Delays.Enqueue_Duration
57 -- (When, DB'Unchecked_Access)
58 -- then
59 -- begin
60 -- A101b : declare
61 -- procedure _clean is
62 -- begin
63 -- System.Tasking.Async_Delays.Cancel_Async_Delay
64 -- (DB'Unchecked_Access);
65 -- return;
66 -- end _clean;
67 -- begin
68 -- abort_undefer.all;
69 -- ...abortable part...
70 -- exception
71 -- when all others =>
72 -- declare
73 -- E105b : exception_occurrence;
74 -- begin
75 -- save_occurrence (E105b, get_current_excep.all.all);
76 -- _clean;
77 -- reraise_occurrence_no_defer (E105b);
78 -- end;
79 -- at end
80 -- _clean;
81 -- end A101b;
82 -- exception
83 -- when _abort_signal =>
84 -- abort_undefer.all;
85 -- end;
86 -- end if;
88 -- if Timed_Out (DB'Unchecked_Access) then
89 -- ...continuation for timeout case...
90 -- end if;
91 -- end;
93 -----------------
94 -- Delay_Block --
95 -----------------
97 type Delay_Block is limited private;
98 type Delay_Block_Access is access all Delay_Block;
100 function Enqueue_Duration
101 (T : in Duration;
102 D : Delay_Block_Access) return Boolean;
103 -- Enqueue the specified relative delay. Returns True if the delay has
104 -- been enqueued, False if it has already expired.
105 -- If the delay has been enqueued, abortion is deferred.
107 procedure Cancel_Async_Delay (D : Delay_Block_Access);
108 -- Cancel the specified asynchronous delay
110 function Timed_Out (D : Delay_Block_Access) return Boolean;
111 pragma Inline (Timed_Out);
112 -- Return True if the delay specified in D has timed out
114 -- There are child units for delays on Ada.Calendar.Time and
115 -- Ada.Real_Time.Time, so that an application will not need to link in
116 -- features that is not using.
118 private
120 type Delay_Block is record
121 Self_Id : Task_ID;
122 -- ID of the calling task
124 Level : ATC_Level_Base;
125 -- Normally Level is the ATC nesting level of the
126 -- async. select statement to which this delay belongs, but
127 -- after a call has been dequeued we set it to
128 -- ATC_Level_Infinity so that the Cancel operation can
129 -- detect repeated calls, and act idempotently.
131 Resume_Time : Duration;
132 -- The absolute wake up time, represented as Duration
134 Timed_Out : Boolean := False;
135 -- Set to true if the delay has timed out
137 Succ, Pred : Delay_Block_Access;
138 -- A double linked list
139 end record;
141 -- The above "overlaying" of Self_ID and Level to hold other
142 -- data that has a non-overlapping lifetime is an unabashed
143 -- hack to save memory.
145 procedure Time_Enqueue
146 (T : Duration;
147 D : Delay_Block_Access);
148 pragma Inline (Time_Enqueue);
149 -- Used by the child units to enqueue delays on the timer queue
150 -- implemented in the body of this package.
152 end System.Tasking.Async_Delays;