Re: ATC, an example please.
- From: Christoph Grein <Christoph.Grein@xxxxxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 13:06:53 +0200
Try the following variant of Dmitry A. Kazakov's code:
with Ada.Text_IO;
procedure ATC_Test is
task A_Task is entry Start; entry Ready; end A_Task;
task body A_Task is
begin
loop
accept Start;
Ada.Text_IO.Put_Line ("Start");
for Iteration in 1..100_000 loop
Ada.Text_IO.Put (".");
delay 0.01;
end loop;
accept Ready;
Ada.Text_IO.Put_Line ("Ready");
end loop;
end A_Task;begin
A_Task.Start; -- Initiate calculation.
select
delay 2.0; -- After time-out expiration, only transfer of control.
Ada.Text_IO.Put_Line ("Expiration");
delay 1.0; -- A_Task still alive and running.
abort A_Task; -- Kill the task!
Ada.Text_IO.Put_Line ("Long calculation abandoned");
then
abort A_Task.Ready; -- Wait for completion.
Ada.Text_IO.Put_Line ("Long calculation completed");
end select;
Ada.Text_IO.Put_Line ("End");end ATC_Test;
.
- References:
- ATC, an example please.
- From: e.coli
- Re: ATC, an example please.
- From: Dmitry A. Kazakov
- ATC, an example please.
- Prev by Date: Re: ATC, an example please.
- Next by Date: Re: Division by zero
- Previous by thread: Re: ATC, an example please.
- Next by thread: Re: ATC, an example please.
- Index(es):
Relevant Pages
|