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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ce290b2dd8bc80e8 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller.gnilink.net!gnilink.net!nwrddc02.gnilink.net.POSTED!72fcb693!not-for-mail From: Fionn Mac Cumhaill Newsgroups: comp.lang.ada Subject: Re: Need info about Ada tasks Message-ID: References: <1r3nd4190fqnicb4tdebo1ctt70cjetnhi@4ax.com> <38vvmtnic6su$.13akh3j9qqeli$.dlg@40tude.net> X-Newsreader: Forte Agent 4.2/32.1118 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 26 Sep 2008 05:06:30 GMT NNTP-Posting-Host: 71.170.53.73 X-Complaints-To: abuse@verizon.net X-Trace: nwrddc02.gnilink.net 1222405590 71.170.53.73 (Fri, 26 Sep 2008 01:06:30 EDT) NNTP-Posting-Date: Fri, 26 Sep 2008 01:06:30 EDT Xref: g2news2.google.com comp.lang.ada:7825 X-Original-Bytes: 2165 Date: 2008-09-26T05:06:30+00:00 List-Id: On Thu, 25 Sep 2008 15:49:28 +0200, "Dmitry A. Kazakov" wrote: >On Thu, 25 Sep 2008 13:31:27 GMT, Fionn Mac Cumhaill wrote: > >> My simple solution has a minor problem; I have a select just after the >> display routine that receives the abort message, but if the message >> doesn't arrive on time I get another iteration of the loop before the >> task aborts. How can I make this thing abort immediately, even when I >> have a delay(60.0) to give a 1-minute delay between display refreshes? >> I.e., how do I bail out in the middle of a delay? > >1. If the abort event is implemented as a protected object: > >task body Refresh_Engine is >begin > loop > ... -- Refresh the display > select -- Timed entry call > Abort_Event.Wait; > exit; > or delay 60.0; > end select; > end loop; >end Refresh_Engine; > >2. If the abort event is signaled by an entry call: > >task body Refresh_Engine is >begin > loop > ... -- Refresh the display > select -- Selective accept with a time out alternative > accept Abort_Event; > exit; > or delay 60.0; > end select; > end loop; >end Refresh_Engine; Many thanks - that was exactly what I needed to know.