| 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 |
-- Copyright (C) 2015-2025, Free Software Foundation, Inc. -- |
| 10 |
-- -- |
| 11 |
-- This specification is derived from the Ada Reference Manual for use with -- |
| 12 |
-- GNAT. The copyright notice above, and the license provisions that follow -- |
| 13 |
-- apply solely to the contents of the part following the private keyword. -- |
| 14 |
-- -- |
| 15 |
-- GNAT is free software; you can redistribute it and/or modify it under -- |
| 16 |
-- terms of the GNU General Public License as published by the Free Soft- -- |
| 17 |
-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 18 |
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
| 19 |
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
| 20 |
-- or FITNESS FOR A PARTICULAR PURPOSE. -- |
| 21 |
-- -- |
| 22 |
-- As a special exception under Section 7 of GPL version 3, you are granted -- |
| 23 |
-- additional permissions described in the GCC Runtime Library Exception, -- |
| 24 |
-- version 3.1, as published by the Free Software Foundation. -- |
| 25 |
-- -- |
| 26 |
-- You should have received a copy of the GNU General Public License and -- |
| 27 |
-- a copy of the GCC Runtime Library Exception along with this program; -- |
| 28 |
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- |
| 29 |
-- <http://www.gnu.org/licenses/>. -- |
| 30 |
-- -- |
| 31 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 32 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 33 |
-- -- |
| 34 |
------------------------------------------------------------------------------ |
| 35 |
|
| 36 |
-- This unit is not implemented in typical GNAT implementations that lie on |
| 37 |
-- top of operating systems, because it is infeasible to implement in such |
| 38 |
-- environments. |
| 39 |
|
| 40 |
-- If a target environment provides appropriate support for this package, |
| 41 |
-- then the Unimplemented_Unit pragma should be removed from this spec and |
| 42 |
-- an appropriate body provided. |
| 43 |
|
| 44 |
with System; |
| 45 |
with System.Multiprocessors; |
| 46 |
|
| 47 |
package Ada.Execution_Time.Group_Budgets is |
| 48 |
pragma Unimplemented_Unit; |
| 49 |
|
| 50 |
type Group_Budget |
| 51 |
(CPU : System.Multiprocessors.CPU := System.Multiprocessors.CPU'First) |
| 52 |
is tagged limited private; |
| 53 |
|
| 54 |
type Group_Budget_Handler is access |
| 55 |
protected procedure (GB : in out Group_Budget); |
| 56 |
|
| 57 |
type Task_Array is |
| 58 |
array (Positive range <>) of Ada.Task_Identification.Task_Id; |
| 59 |
|
| 60 |
Min_Handler_Ceiling : constant System.Any_Priority := |
| 61 |
System.Any_Priority'First; |
| 62 |
-- Initial value is an arbitrary choice ??? |
| 63 |
|
| 64 |
procedure Add_Task |
| 65 |
(GB : in out Group_Budget; |
| 66 |
T : Ada.Task_Identification.Task_Id); |
| 67 |
|
| 68 |
procedure Remove_Task |
| 69 |
(GB : in out Group_Budget; |
| 70 |
T : Ada.Task_Identification.Task_Id); |
| 71 |
|
| 72 |
function Is_Member |
| 73 |
(GB : Group_Budget; |
| 74 |
T : Ada.Task_Identification.Task_Id) return Boolean; |
| 75 |
|
| 76 |
function Is_A_Group_Member |
| 77 |
(T : Ada.Task_Identification.Task_Id) return Boolean; |
| 78 |
|
| 79 |
function Members (GB : Group_Budget) return Task_Array; |
| 80 |
|
| 81 |
procedure Replenish |
| 82 |
(GB : in out Group_Budget; |
| 83 |
To : Ada.Real_Time.Time_Span); |
| 84 |
|
| 85 |
procedure Add |
| 86 |
(GB : in out Group_Budget; |
| 87 |
Interval : Ada.Real_Time.Time_Span); |
| 88 |
|
| 89 |
function Budget_Has_Expired (GB : Group_Budget) return Boolean; |
| 90 |
|
| 91 |
function Budget_Remaining |
| 92 |
(GB : Group_Budget) return Ada.Real_Time.Time_Span; |
| 93 |
|
| 94 |
procedure Set_Handler |
| 95 |
(GB : in out Group_Budget; |
| 96 |
Handler : Group_Budget_Handler); |
| 97 |
|
| 98 |
function Current_Handler (GB : Group_Budget) return Group_Budget_Handler; |
| 99 |
|
| 100 |
procedure Cancel_Handler |
| 101 |
(GB : in out Group_Budget; |
| 102 |
Cancelled : out Boolean); |
| 103 |
|
| 104 |
Group_Budget_Error : exception; |
| 105 |
|
| 106 |
private |
| 107 |
type Group_Budget |
| 108 |
(CPU : System.Multiprocessors.CPU := System.Multiprocessors.CPU'First) |
| 109 |
is tagged limited null record; |
| 110 |
end Ada.Execution_Time.Group_Budgets; |