From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3b69de4361f731f1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!usenet-fr.net!news.enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Christoph Grein Newsgroups: comp.lang.ada Subject: Re: ATC, an example please. Date: Thu, 30 Jun 2005 13:06:53 +0200 Organization: Cuivre, Argent, Or Message-ID: References: <1120121092.240284.285260@g14g2000cwa.googlegroups.com> Reply-To: Christoph.Grein@eurocopter.com NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Content-Transfer-Encoding: 7BIT X-Trace: melchior.cuivre.fr.eu.org 1120130789 40052 212.85.156.195 (30 Jun 2005 11:26:29 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Thu, 30 Jun 2005 11:26:29 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0 X-OriginalArrivalTime: 30 Jun 2005 11:21:06.0473 (UTC) FILETIME=[CECE6990:01C57D65] X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:11759 Date: 2005-06-30T13:06:53+02:00 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;