comp.lang.ada
 help / color / mirror / Atom feed
* Are delay statements abortable?
@ 2000-01-10  0:00 davidb42
  2000-01-10  0:00 ` Ross
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: davidb42 @ 2000-01-10  0:00 UTC (permalink / raw)


Are delay statements interruptable/abortable?

I was expecting delay statements in tasks (or in the abortable part of
an asynchronous select construct) to be brought to a premature end on
aborting the task (or on the triggering event).

However, in the Ada implementation I am using, the abortion only seems
to take effect at the expiry of the delay.

For example, in the program below, the main task completes after 25
seconds, but the dependent task (and thus the program as a whole)
doesn't terminate until 40 seconds (at expiry of the 2nd 20 second
delay).

Is this right?
	David Bowerman
	CSC Australia.

   **************************************************************
with Text_IO;
procedure Test_Abort_of_Delay is

  task Dependent_Task;
  task body Dependent_Task is
  begin
    Text_IO.Put_Line ("Starting dependent task.");

    delay 20.0;
    Text_IO.Put_Line ("20 second delay has completed.");
    delay 20.0;
    Text_IO.Put_Line ("40 second delay has completed.");
    delay 20.0;
    Text_IO.Put_Line ("60 second delay has completed.");
    delay 20.0;
    Text_IO.Put_Line ("80 second delay has completed.");

    Text_IO.Put_Line ("Completing dependent task.");
  end Dependent_Task;

begin
  -- Main task
  Text_IO.Put_Line ("Starting main task.");

  delay 25.0;
  abort Dependent_Task;

  Text_IO.Put_Line ("Completing main task.");
end Test_Abort_of_Delay;


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: Are delay statements abortable?
  2000-01-10  0:00 Are delay statements abortable? davidb42
@ 2000-01-10  0:00 ` Ross
  2000-01-10  0:00 ` Tucker Taft
  2000-01-10  0:00 ` susan satnford
  2 siblings, 0 replies; 4+ messages in thread
From: Ross @ 2000-01-10  0:00 UTC (permalink / raw)


I don't believe they are in ada terms, but you could always pull the
plug.....
R.

davidb42@my-deja.com wrote:

> Are delay statements interruptable/abortable?
>
> I was expecting delay statements in tasks (or in the abortable part of
> an asynchronous select construct) to be brought to a premature end on
> aborting the task (or on the triggering event).
>
> However, in the Ada implementation I am using, the abortion only seems
> to take effect at the expiry of the delay.
>
> For example, in the program below, the main task completes after 25
> seconds, but the dependent task (and thus the program as a whole)
> doesn't terminate until 40 seconds (at expiry of the 2nd 20 second
> delay).
>
> Is this right?
>         David Bowerman
>         CSC Australia.
>
>    **************************************************************
> with Text_IO;
> procedure Test_Abort_of_Delay is
>
>   task Dependent_Task;
>   task body Dependent_Task is
>   begin
>     Text_IO.Put_Line ("Starting dependent task.");
>
>     delay 20.0;
>     Text_IO.Put_Line ("20 second delay has completed.");
>     delay 20.0;
>     Text_IO.Put_Line ("40 second delay has completed.");
>     delay 20.0;
>     Text_IO.Put_Line ("60 second delay has completed.");
>     delay 20.0;
>     Text_IO.Put_Line ("80 second delay has completed.");
>
>     Text_IO.Put_Line ("Completing dependent task.");
>   end Dependent_Task;
>
> begin
>   -- Main task
>   Text_IO.Put_Line ("Starting main task.");
>
>   delay 25.0;
>   abort Dependent_Task;
>
>   Text_IO.Put_Line ("Completing main task.");
> end Test_Abort_of_Delay;
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.





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

* Re: Are delay statements abortable?
  2000-01-10  0:00 Are delay statements abortable? davidb42
  2000-01-10  0:00 ` Ross
  2000-01-10  0:00 ` Tucker Taft
@ 2000-01-10  0:00 ` susan satnford
  2 siblings, 0 replies; 4+ messages in thread
From: susan satnford @ 2000-01-10  0:00 UTC (permalink / raw)



davidb42 wrote:
> 
> 
> Are delay statements interruptable/abortable?
> yes they are
> I was expecting delay statements in tasks (or in the abortable part of
> an asynchronous select construct) to be brought to a premature end on
> aborting the task (or on the triggering event).
> 
> However, in the Ada implementation I am using, the abortion only seems
> to take effect at the expiry of the delay.
> 
> For example, in the program below, the main task completes after 25
> seconds, but the dependent task (and thus the program as a whole)
> doesn't terminate until 40 seconds (at expiry of the 2nd 20 second
> delay).
> 
> Is this right?
> David Bowerman
> CSC Australia.
> 
>    **************************************************************
> with Text_IO;
> procedure Test_Abort_of_Delay is
> 
>   task Dependent_Task;
>   task body Dependent_Task is
>   begin
>     Text_IO.Put_Line ("Starting dependent task.");
> 
>     delay 20.0;
>     Text_IO.Put_Line ("20 second delay has completed.");
>     delay 20.0;
>     Text_IO.Put_Line ("40 second delay has completed.");
>     delay 20.0;
>     Text_IO.Put_Line ("60 second delay has completed.");
>     delay 20.0;
>     Text_IO.Put_Line ("80 second delay has completed.");
> 
>     Text_IO.Put_Line ("Completing dependent task.");
>   end Dependent_Task;
> 
> REMOVED INCLUDED FILE Test_Abort_of_Delay;
> 
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.


--
Posted via CNET Help.com
http://www.help.com/




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

* Re: Are delay statements abortable?
  2000-01-10  0:00 Are delay statements abortable? davidb42
  2000-01-10  0:00 ` Ross
@ 2000-01-10  0:00 ` Tucker Taft
  2000-01-10  0:00 ` susan satnford
  2 siblings, 0 replies; 4+ messages in thread
From: Tucker Taft @ 2000-01-10  0:00 UTC (permalink / raw)
  To: davidb42

davidb42@my-deja.com wrote:
> 
> Are delay statements interruptable/abortable?

Yes.

> 
> I was expecting delay statements in tasks (or in the abortable part of
> an asynchronous select construct) to be brought to a premature end on
> aborting the task (or on the triggering event).

They should be.
> 
> However, in the Ada implementation I am using, the abortion only seems
> to take effect at the expiry of the delay.

This would not qualify as a "real-time-systems-annex" supporting
implementation in Ada 95.  "Real-time" implementations are required
to abort preemptively in Ada 95 (see RM95 D.6(2)).
> 
> For example, in the program below, the main task completes after 25
> seconds, but the dependent task (and thus the program as a whole)
> doesn't terminate until 40 seconds (at expiry of the 2nd 20 second
> delay).
> 
> Is this right?

In a non-real-time implementation, this is "correct" but not particularly
helpful.  In a "real-time" Ada 95 implementation, this would be incorrect.

>         David Bowerman
>         CSC Australia.
-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




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

end of thread, other threads:[~2000-01-10  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-10  0:00 Are delay statements abortable? davidb42
2000-01-10  0:00 ` Ross
2000-01-10  0:00 ` Tucker Taft
2000-01-10  0:00 ` susan satnford

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