Re: ATC, an example please.



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;

.



Relevant Pages

  • RE: Creating a que
    ... and entry count in a collection. ... if eo.Count> 0 then bMoreData = True ... At the beginning of the loop you assume this is the last time through the ... Then you go through each item in the Entries ...
    (microsoft.public.excel.programming)
  • RE: Creating a que
    ... and entry count in a collection. ... if eo.Count> 0 then bMoreData = True ... At the beginning of the loop you assume this is the last time through the ... Then you go through each item in the Entries ...
    (microsoft.public.excel.programming)
  • Re: Very confused by Ada tasking, can not explain the execution outcome.
    ... I am trying to simulate a concurrent resource allocator with Ada's ... task and protected type. ... entry calls, so no entry is defined in tasks. ... loop, 'while rounds<2 loop', how could it get out of the loop if ...
    (comp.lang.ada)
  • Re: How to Delete Rows in Excel In a Do Loop
    ... have to delete there are some that have a entry in each and every cell ... Richard Buttrey wrote: ... time you go through the loop. ... Now copy this formula down column A for the whole database ...
    (microsoft.public.excel.worksheet.functions)
  • RE: Creating a que
    ... and entry count in a collection. ... if eo.Count> 0 then bMoreData = True ... At the beginning of the loop you assume this is the last time through the ... Then you go through each item in the Entries ...
    (microsoft.public.excel.programming)