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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a0f8bfc88538cab5 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 22 Jun 2005 20:43:15 -0500 From: "Steve" Newsgroups: comp.lang.ada References: <1119463703.048124.135330@o13g2000cwo.googlegroups.com> Subject: Re: task time-out&abort Date: Wed, 22 Jun 2005 18:44:34 -0700 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Message-ID: NNTP-Posting-Host: 24.22.63.157 X-Trace: sv3-qTmy0OcQb5B32tK35pTNdEyTrdhmFwMc9QFAhXBjIhvpvQNVn+Z7Xv0yl34pujXDzLnq0MnO4knuXwn!EUN44LRt+iiOY2hDSiBKWSRGBTmDsLsYEl9DM7XwU/6UT3ZXGImlC3rAYVHf X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.31 Xref: g2news1.google.com comp.lang.ada:11580 Date: 2005-06-22T18:44:34-07:00 List-Id: If you just want to see Asynchronous Transfer of control in action, change your example to read: task body Un_Task is begin loop select accept Uno do Ada.Text_Io.Put_Line("foo"); end Uno; loop -- ;) delay(0.0); end loop; or accept Due do Ada.Text_Io.Put_Line("buffering"); Ada.Text_Io.Put_Line("bar"); end Due; end select; end loop; end Un_Task; Note: I didn't test this to verify, but I think it will give you the result you're looking for. Uno starts the long operation. Since the task will not go back to the select until the loop is done, your abort should kick in. Also... In my informal view of things, you should minimize the amount of work you do inside of an accept block. During the rendevous, only one of the tasks is active, so it kind of defeats the purpose of using a separate task. In fact you could change your example task to: task body Un_Task is begin loop select accept Uno; Ada.Text_Io.Put_Line("foo"); loop -- ;) delay(0.0); end loop; or accept Due; Ada.Text_Io.Put_Line("buffering"); Ada.Text_Io.Put_Line("bar"); end select; end loop; end Un_Task; Which completely eliminates any work done inside the accept block. Steve (The Duck)