* snames.ads-tmpl (Name_Ivdep): New pragma-related name.
[official-gcc.git] / gcc / testsuite / gnat.dg / timer_cancel.adb
blobc300b47a859eb6610482ef56dd0c38552113142f
1 -- { dg-do run }
3 with Ada.Real_Time.Timing_Events;
4 use Ada.Real_Time, Ada.Real_Time.Timing_Events;
6 procedure Timer_Cancel is
8 E : Timing_Event;
9 C : Boolean;
11 protected Dummy is
12 procedure Trigger (Event : in out Timing_Event);
13 end Dummy;
15 protected body Dummy is
16 procedure Trigger (Event : in out Timing_Event) is
17 begin
18 null;
19 end Trigger;
20 end Dummy;
22 begin
23 Set_Handler (E, Time_Last, Dummy.Trigger'Unrestricted_Access);
25 if Time_Of_Event (E) /= Time_Last then
26 raise Program_Error with "Event time not set correctly";
27 end if;
29 Cancel_Handler (E, C);
31 if not C then
32 raise Program_Error with "Event triggered already";
33 end if;
35 if Time_Of_Event (E) /= Time_First then
36 raise Program_Error with "Event time not reset correctly";
37 end if;
38 end Timer_Cancel;