comp.lang.ada
 help / color / mirror / Atom feed
* Whats wrong with my Callbacks?
@ 2002-05-17  9:52 Darren
  2002-05-17 10:57 ` David C. Hoos, Sr.
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Darren @ 2002-05-17  9:52 UTC (permalink / raw)


Could anybody tell me why this isnt working?

/D


begin 666 b.adb
M=VET:"!!.PT*=VET:"!!9&$N56YC:&5C:V5D7T-O;G9E<G-I;VXL(%1E>'1?
M26\[#0H-"G!R;V-E9'5R92!"(&ES#0H-"B @('!R;V-E9'5R92!0(&ES#0H@
M("!B96=I;@T*(" @(" @5&5X=%]);RYP=70H(DAI(BD[#0H@("!E;F0@4#L-
M"B @( T*(" @='EP92!,;V-A;%]4>7!E(&ES(&%C8V5S<R!P<F]C961U<F4[
M#0H@(" -"B @(&9U;F-T:6]N(%1O7T=L;V)A;"!I<PT*(" @(" @;F5W($%D
M82Y5;F-H96-K961?0V]N=F5R<VEO;BA,;V-A;%]4>7!E+"!!+E!R;V-?4'1R
M7U1Y<&4I.PT*(" @(" @#0IB96=I;@T*#0H@("!!+D=L;V)A;%]0='(@.CT@
M5&]?1VQO8F%L*% G86-C97-S*3L-"B @( T*+2T@("!!+D=L;V)A;%]0='(@
F.CT@4"=5;G)E<W1R:6-T961?06-C97-S.PT*96YD($([#0H@(" `
`
end

begin 666 a.ads
M<&%C:V%G92!!(&ES#0H-"B @('1Y<&4@4')O8U]0=')?5'EP92!I<R!A8V-E
M<W,@<')O8V5D=7)E.PT*(" @#0H@("!';&]B86Q?4'1R(#H@4')O8U]0=')?
K5'EP93L-"B @( T*=&%S:R!S:6T@:7,-"F5N9"!S:6T[#0H-"F5N9"!!.P``
`
end

begin 666 a.adb
M<&%C:V%G92!B;V1Y($$@:7,-"@T*(" @=&%S:R!B;V1Y('-I;2!I<PT*(" @
M8F5G:6X-"B @(" @(&QO;W -"B @(" @(" @($=L;V)A;%]0='(N86QL.PT*
M(" @(" @96YD(&QO;W [#0H@("!E;F0@<VEM.PT*#0IB96=I;@T*(" @;G5L
*;#L-"F5N9"!A.P``
`
end




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Whats wrong with my Callbacks?
  2002-05-17  9:52 Whats wrong with my Callbacks? Darren
@ 2002-05-17 10:57 ` David C. Hoos, Sr.
  2002-05-17 11:26 ` Preben Randhol
  2002-05-18  1:27 ` Steve Doiel
  2 siblings, 0 replies; 4+ messages in thread
From: David C. Hoos, Sr. @ 2002-05-17 10:57 UTC (permalink / raw)


[-- 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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Whats wrong with my Callbacks?
  2002-05-17  9:52 Whats wrong with my Callbacks? Darren
  2002-05-17 10:57 ` David C. Hoos, Sr.
@ 2002-05-17 11:26 ` Preben Randhol
  2002-05-18  1:27 ` Steve Doiel
  2 siblings, 0 replies; 4+ messages in thread
From: Preben Randhol @ 2002-05-17 11:26 UTC (permalink / raw)


On Fri, 17 May 2002 11:52:10 +0200, Darren wrote:
> Could anybody tell me why this isnt working?

Not until you post as text! 

> begin 666 b.adb
> M=VET:"!!.PT*=VET:"!!9&$N56YC:&5C:V5D7T-O;G9E<G-I;VXL(%1E>'1?
> M26\[#0H-"G!R;V-E9'5R92!"(&ES#0H-"B @('!R;V-E9'5R92!0(&ES#0H@
> M("!B96=I;@T*(" @(" @5&5X=%]);RYP=70H(DAI(BD[#0H@("!E;F0@4#L-
> M"B @( T*(" @='EP92!,;V-A;%]4>7!E(&ES(&%C8V5S<R!P<F]C961U<F4[
> M#0H@(" -"B @(&9U;F-T:6]N(%1O7T=L;V)A;"!I<PT*(" @(" @;F5W($%D
> M82Y5;F-H96-K961?0V]N=F5R<VEO;BA,;V-A;%]4>7!E+"!!+E!R;V-?4'1R
> M7U1Y<&4I.PT*(" @(" @#0IB96=I;@T*#0H@("!!+D=L;V)A;%]0='(@.CT@
> M5&]?1VQO8F%L*% G86-C97-S*3L-"B @( T*+2T@("!!+D=L;V)A;%]0='(@
> F.CT@4"=5;G)E<W1R:6-T961?06-C97-S.PT*96YD($([#0H@(" `
> `
> end
> 
> begin 666 a.ads
> M<&%C:V%G92!!(&ES#0H-"B @('1Y<&4@4')O8U]0=')?5'EP92!I<R!A8V-E
> M<W,@<')O8V5D=7)E.PT*(" @#0H@("!';&]B86Q?4'1R(#H@4')O8U]0=')?
> K5'EP93L-"B @( T*=&%S:R!S:6T@:7,-"F5N9"!S:6T[#0H-"F5N9"!!.P``
> `
> end
> 
> begin 666 a.adb
> M<&%C:V%G92!B;V1Y($$@:7,-"@T*(" @=&%S:R!B;V1Y('-I;2!I<PT*(" @
> M8F5G:6X-"B @(" @(&QO;W -"B @(" @(" @($=L;V)A;%]0='(N86QL.PT*
> M(" @(" @96YD(&QO;W [#0H@("!E;F0@<VEM.PT*#0IB96=I;@T*(" @;G5L
> *;#L-"F5N9"!A.P``
> `
> end
> 


-- 
"Jeg tror nordmenn har glemt hvordan de tilbreder fisk. De er mest
 opptatt av firkantet fisk."
  --  Kristian Kristiansen, yrkesfisker, aftenposten.no 19/04/02



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Whats wrong with my Callbacks?
  2002-05-17  9:52 Whats wrong with my Callbacks? Darren
  2002-05-17 10:57 ` David C. Hoos, Sr.
  2002-05-17 11:26 ` Preben Randhol
@ 2002-05-18  1:27 ` Steve Doiel
  2 siblings, 0 replies; 4+ messages in thread
From: Steve Doiel @ 2002-05-18  1:27 UTC (permalink / raw)


Try this for a.adb

with Ada.Text_io;
package body A is

   task body sim is
   begin
      loop
         Global_Ptr.all;
      end loop;
   exception
     when others =>
       Ada.Text_Io.Put_Line( "Exception!!!" );
   end sim;

begin
   null;
end a;

The default behavior when an unhandled exception occurs in a task is for the
task to terminate silently.

As to why it isn't working... to begin with the task may try dereferencing
the pointer before it has been assigned.

SteveD

"Darren" <sebastian.madunic@avionics.saab.se> wrote in message
news:ac2jku$t1s$1@newstoo.ericsson.se...
> Could anybody tell me why this isnt working?
>
> /D
>
>
>





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-05-18  1:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-17  9:52 Whats wrong with my Callbacks? Darren
2002-05-17 10:57 ` David C. Hoos, Sr.
2002-05-17 11:26 ` Preben Randhol
2002-05-18  1:27 ` Steve Doiel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox