1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT RUN-TIME COMPONENTS                         --
4--                                                                          --
5--      A D A . E X E C U T I O N _ T I M E . G R O U P _ B U D G E T S     --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9-- This specification is derived from the Ada Reference Manual for use with --
10-- GNAT.  In accordance with the copyright of that document, you can freely --
11-- copy and modify this specification,  provided that if you redistribute a --
12-- modified version,  any changes that you have made are clearly indicated. --
13--                                                                          --
14------------------------------------------------------------------------------
15
16--  This unit is not implemented in typical GNAT implementations that lie on
17--  top of operating systems, because it is infeasible to implement in such
18--  environments.
19
20--  If a target environment provides appropriate support for this package,
21--  then the Unimplemented_Unit pragma should be removed from this spec and
22--  an appropriate body provided.
23
24with System;
25
26package Ada.Execution_Time.Group_Budgets is
27   pragma Preelaborate;
28
29   pragma Unimplemented_Unit;
30
31   type Group_Budget is tagged limited private;
32
33   type Group_Budget_Handler is access
34      protected procedure (GB : in out Group_Budget);
35
36   type Task_Array is
37      array (Positive range <>) of Ada.Task_Identification.Task_Id;
38
39   Min_Handler_Ceiling : constant System.Any_Priority :=
40                           System.Any_Priority'First;
41   --  Initial value is an arbitrary choice ???
42
43   procedure Add_Task
44     (GB : in out Group_Budget;
45      T  : Ada.Task_Identification.Task_Id);
46
47   procedure Remove_Task
48     (GB : in out Group_Budget;
49      T  : Ada.Task_Identification.Task_Id);
50
51   function Is_Member
52     (GB : Group_Budget;
53      T  : Ada.Task_Identification.Task_Id) return Boolean;
54
55   function Is_A_Group_Member
56     (T : Ada.Task_Identification.Task_Id) return Boolean;
57
58   function Members (GB : Group_Budget) return Task_Array;
59
60   procedure Replenish
61     (GB : in out Group_Budget;
62      To : Ada.Real_Time.Time_Span);
63
64   procedure Add
65     (GB       : in out Group_Budget;
66      Interval : Ada.Real_Time.Time_Span);
67
68   function Budget_Has_Expired (GB : Group_Budget) return Boolean;
69
70   function Budget_Remaining
71     (GB : Group_Budget) return Ada.Real_Time.Time_Span;
72
73   procedure Set_Handler
74     (GB      : in out Group_Budget;
75      Handler : Group_Budget_Handler);
76
77   function Current_Handler (GB : Group_Budget) return Group_Budget_Handler;
78
79   procedure Cancel_Handler
80     (GB        : in out Group_Budget;
81      Cancelled : out Boolean);
82
83   Group_Budget_Error : exception;
84
85private
86   type Group_Budget is tagged limited null record;
87end Ada.Execution_Time.Group_Budgets;
88