Timing events in GNAT GPL 2006
- From: "Rolf" <rolf.ebert_nospam_@xxxxxxx>
- Date: 12 Jan 2007 08:49:14 -0800
I wanted to test the new Ada timing events with GNAT GPL 2006. Here is
some code that should print a line every second. GNAT does not accept
my protected procedure when setting the handler. Why? I don't see my
error.
Rolf
--
with Ada.Real_Time; use Ada.Real_Time;
with Ada.Real_Time.Timing_Events; use Ada.Real_Time.Timing_Events;
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Timing_Event is
protected Clock_Tick is
procedure Inc_Clock (Ev : Timing_Event);
end Clock_Tick;
Tick : Timing_Event;
One_Sec : constant Time_Span := Seconds (1);
protected body Clock_Tick is
procedure Inc_Clock (Ev : Timing_Event)
is
begin
Put_Line ("Inc_Sec");
-- using Time_Span
Set_Handler (Tick, One_Sec, Handler => Inc_Clock'Access);
end Inc_Clock;
end Clock_Tick;
begin
-- using absolute time
Set_Handler (Tick, Clock + One_Sec, Clock_Tick.Inc_Clock'Access);
loop null; end loop;
end Test_Timing_Event;
$ gnatmake -gnat05 test_timing_event.adb
gcc -c -gnat05 test_timing_event.adb
test_timing_event.adb:20:10: no candidate interpretations match the
actuals:
test_timing_event.adb:20:29: expected private type "Ada.Real_Time.Time"
test_timing_event.adb:20:29: found private type
"Ada.Real_Time.Time_Span"
test_timing_event.adb:20:29: ==> in call to "Set_Handler" at
a-rttiev.ads:47
test_timing_event.adb:20:58: expected type
"Ada.Real_Time.Timing_Events.Timing_Event_Handler"
test_timing_event.adb:20:58: found type access to procedure "Inc_Clock"
defined at line 20
test_timing_event.adb:20:58: ==> in call to "Set_Handler" at
a-rttiev.ads:52
test_timing_event.adb:26:04: no candidate interpretations match the
actuals:
test_timing_event.adb:26:29: expected private type
"Ada.Real_Time.Time_Span"
test_timing_event.adb:26:29: found private type "Ada.Real_Time.Time"
test_timing_event.adb:26:29: ==> in call to "Set_Handler" at
a-rttiev.ads:52
test_timing_event.adb:26:60: expected type
"Ada.Real_Time.Timing_Events.Timing_Event_Handler"
test_timing_event.adb:26:60: found type access to procedure "Inc_Clock"
defined at line 26
test_timing_event.adb:26:60: ==> in call to "Set_Handler" at
a-rttiev.ads:47
gnatmake: "test_timing_event.adb" compilation error
$ gnatls -v
GNATLS GPL 2006 (20060522-34)
Copyright 1997-2006, Free Software Foundation, Inc.
.
- Follow-Ups:
- RE: Timing events in GNAT GPL 2006
- From: Vo, Anh \(US SSA\)
- RE: Timing events in GNAT GPL 2006
- Prev by Date: Generics and selection based on type
- Next by Date: RE: Timing events in GNAT GPL 2006
- Previous by thread: Generics and selection based on type
- Next by thread: RE: Timing events in GNAT GPL 2006
- Index(es):
Relevant Pages
|