| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT RUN-TIME COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- A D A . R E A L _ T I M E . T I M I N G _ E V E N T S -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 2005-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 |
with Ada.Finalization; |
| 37 |
|
| 38 |
package Ada.Real_Time.Timing_Events is |
| 39 |
|
| 40 |
type Timing_Event is tagged limited private; |
| 41 |
|
| 42 |
type Timing_Event_Handler |
| 43 |
is access protected procedure (Event : in out Timing_Event); |
| 44 |
|
| 45 |
procedure Set_Handler |
| 46 |
(Event : in out Timing_Event; |
| 47 |
At_Time : Time; |
| 48 |
Handler : Timing_Event_Handler); |
| 49 |
|
| 50 |
procedure Set_Handler |
| 51 |
(Event : in out Timing_Event; |
| 52 |
In_Time : Time_Span; |
| 53 |
Handler : Timing_Event_Handler); |
| 54 |
|
| 55 |
function Current_Handler |
| 56 |
(Event : Timing_Event) return Timing_Event_Handler; |
| 57 |
|
| 58 |
procedure Cancel_Handler |
| 59 |
(Event : in out Timing_Event; |
| 60 |
Cancelled : out Boolean); |
| 61 |
|
| 62 |
function Time_Of_Event (Event : Timing_Event) return Time; |
| 63 |
|
| 64 |
-- The compilation closure of this version (as opposed to the hie version) |
| 65 |
-- of Ada.Real_TIme.Timing_Events includes a specification of a |
| 66 |
-- Concurrent Partition_Elaboration_Policy. Thus, a bind-time error |
| 67 |
-- will result if this unit occurs in the same partition as a conflicting |
| 68 |
-- Partition_Elaboration_Policy specification. |
| 69 |
|
| 70 |
private |
| 71 |
|
| 72 |
type Timing_Event is new Ada.Finalization.Limited_Controlled with record |
| 73 |
Timeout : Time := Time_First; |
| 74 |
-- The time at which the user's handler should be invoked when the |
| 75 |
-- event is "set" (i.e., when Handler is not null). |
| 76 |
|
| 77 |
Handler : Timing_Event_Handler; |
| 78 |
-- An access value designating the protected procedure to be invoked |
| 79 |
-- at the Timeout time in the future. When this value is null the event |
| 80 |
-- is said to be "cleared" and no timeout is processed. |
| 81 |
end record; |
| 82 |
|
| 83 |
overriding procedure Finalize (This : in out Timing_Event); |
| 84 |
-- Finalization procedure is required to satisfy (RM D.15 (19/2)), which |
| 85 |
-- says that the object must be cleared on finalization. |
| 86 |
|
| 87 |
end Ada.Real_Time.Timing_Events; |