From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Whats wrong with my Callbacks?
Date: Fri, 17 May 2002 05:57:48 -0500
Date: 2002-05-17T05:57:48-05:00 [thread overview]
Message-ID: <mailman.1021633082.11758.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: ac2jku$t1s$1@newstoo.ericsson.se
[-- Attachment #1: Type: text/plain, Size: 820 bytes --]
----- Original Message -----
From: "Darren" <sebastian.madunic@avionics.saab.se>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: May 17, 2002 4:52 AM
Subject: Whats wrong with my Callbacks?
> Could anybody tell me why this isnt working?
>
If you add a delay statement (e.g. delay 10.0;)
as the last statement in your main program, the program
will continue to run until the delay expires.
Without the delay, the main program immediately
terminates, causing procedure P to no longer exist;
However, in the attachments, I show a better way;
> /D
>
>
>
------------------------------------------------------------------------------
--
>
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>
>
[-- Attachment #2: b.adb --]
[-- Type: application/octet-stream, Size: 211 bytes --]
with A;
with Ada.Unchecked_Conversion, Text_Io;
procedure B is
procedure P is
begin
Text_Io.put("Hi");
end P;
Sim : A.Sim (P'Unrestricted_Access);
begin
delay 10.0;
abort Sim;
end B;
[-- Attachment #3: a.ads --]
[-- Type: application/octet-stream, Size: 151 bytes --]
package A is
type Proc_Ptr_Type is access procedure;
Global_Ptr : Proc_Ptr_Type;
task type sim (Callback : Proc_Ptr_Type) is
end sim;
end A;
[-- Attachment #4: a.adb --]
[-- Type: application/octet-stream, Size: 151 bytes --]
with Ada.Text_Io;
package body A is
task body sim is
begin
loop
Callback.all;
end loop;
end sim;
begin
null;
end a;
next prev parent reply other threads:[~2002-05-17 10:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-17 9:52 Whats wrong with my Callbacks? Darren
2002-05-17 10:57 ` David C. Hoos, Sr. [this message]
2002-05-17 11:26 ` Preben Randhol
2002-05-18 1:27 ` Steve Doiel
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox