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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c33f8f65997c21d0 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.216.141.136 with SMTP id g8mr271437wej.1.1348089100712; Wed, 19 Sep 2012 14:11:40 -0700 (PDT) Path: q11ni137911389wiw.1!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.130.MISMATCH!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!feeds.phibee-telecom.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!gegeweb.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Problem with task component Date: Wed, 19 Sep 2012 23:11:20 +0200 Organization: cbb software GmbH Message-ID: <187uk10m6z8xj.yr1cpbgrdur$.dlg@40tude.net> References: <1667b8e2qt7ei$.1gg1h3hrp9amz$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 9A8bJrx4NhDLcSmbrb6AdA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-09-19T23:11:20+02:00 List-Id: On Wed, 19 Sep 2012 21:40:40 +0100, Simon Wright wrote: > Also, it seems to me that if I don't use pointers I'm going to have > trouble finalizing the object: the contained task is sitting there and > prevents leaving the scope in which its containing object is declared, > so the containing object doesn't get finalized and there's no > opportunity for Finalize to tell the task to stop. You need an open terminate-alternative ("or terminate;") when the object containing the task component is about to finalize. The usual problem is that the terminate-alternative does not live together with the delay-alternative and/or else-part, which makes it quite a challenge to implement something like a typical "driver" component task: task body Driver is begin loop do I/O; exit/terminate when parent dies; end loop; end Driver; If the I/O subsystem calls to the task upon I/O completion, you could try something like this: task body Driver is begin loop Start_IO (Self); select accept Completed (...); ... -- Process the data or accept Canceled; ... -- I/O was canceled or accept Error (...); ... -- I/O error or terminate; -- Still have troubles killing all outstanding requests end select; -- which may refer to the driver task, that is gone end loop; -- by now end Driver; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de