mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-15 13:01:06 +08:00
re PR ada/41383 (Timing_Events: Event time not cleared after Cancel_Handler)
gcc/ada/ PR ada/41383 * a-rttiev.adb (Time_Of_Event): Return Time_First for unset event. gcc/testsuite/ PR ada/41383 * gnat.dg/timer_cancel.adb: New test. From-SVN: r152487
This commit is contained in:
parent
6fa30ef281
commit
2c12a29243
gcc
@ -1,3 +1,8 @@
|
||||
2009-10-06 Samuel Tardieu <sam@rfc1149.net>
|
||||
|
||||
PR ada/41383
|
||||
* a-rttiev.adb (Time_Of_Event): Return Time_First for unset event.
|
||||
|
||||
2009-10-06 Samuel Tardieu <sam@rfc1149.net>
|
||||
|
||||
PR ada/38333
|
||||
|
@ -332,7 +332,13 @@ package body Ada.Real_Time.Timing_Events is
|
||||
|
||||
function Time_Of_Event (Event : Timing_Event) return Time is
|
||||
begin
|
||||
return Event.Timeout;
|
||||
-- RM D.15(18/2): Time_First must be returned if the event is not set
|
||||
|
||||
if Event.Handler = null then
|
||||
return Time_First;
|
||||
else
|
||||
return Event.Timeout;
|
||||
end if;
|
||||
end Time_Of_Event;
|
||||
|
||||
--------------
|
||||
|
@ -1,3 +1,8 @@
|
||||
2009-10-06 Samuel Tardieu <sam@rfc1149.net>
|
||||
|
||||
PR ada/41383
|
||||
* gnat.dg/timer_cancel.adb: New test.
|
||||
|
||||
2009-10-06 Samuel Tardieu <sam@rfc1149.net>
|
||||
|
||||
PR ada/38333
|
||||
|
38
gcc/testsuite/gnat.dg/timer_cancel.adb
Normal file
38
gcc/testsuite/gnat.dg/timer_cancel.adb
Normal file
@ -0,0 +1,38 @@
|
||||
-- { dg-do run }
|
||||
|
||||
with Ada.Real_Time.Timing_Events;
|
||||
use Ada.Real_Time, Ada.Real_Time.Timing_Events;
|
||||
|
||||
procedure Timer_Cancel is
|
||||
|
||||
E : Timing_Event;
|
||||
C : Boolean;
|
||||
|
||||
protected Dummy is
|
||||
procedure Trigger (Event : in out Timing_Event);
|
||||
end Dummy;
|
||||
|
||||
protected body Dummy is
|
||||
procedure Trigger (Event : in out Timing_Event) is
|
||||
begin
|
||||
null;
|
||||
end Trigger;
|
||||
end Dummy;
|
||||
|
||||
begin
|
||||
Set_Handler (E, Time_Last, Dummy.Trigger'Unrestricted_Access);
|
||||
|
||||
if Time_Of_Event (E) /= Time_Last then
|
||||
raise Program_Error with "Event time not set correctly";
|
||||
end if;
|
||||
|
||||
Cancel_Handler (E, C);
|
||||
|
||||
if not C then
|
||||
raise Program_Error with "Event triggered already";
|
||||
end if;
|
||||
|
||||
if Time_Of_Event (E) /= Time_First then
|
||||
raise Program_Error with "Event time not reset correctly";
|
||||
end if;
|
||||
end Timer_Cancel;
|
Loading…
x
Reference in New Issue
Block a user