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.7 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4bd6ca8f7a1eb225 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.35.68 with SMTP id f4mr9816682pbj.5.1322185079757; Thu, 24 Nov 2011 17:37:59 -0800 (PST) Path: lh20ni14741pbb.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: "Rego, P." Newsgroups: comp.lang.ada Subject: Re: Class with task destructor Date: Thu, 24 Nov 2011 17:37:59 -0800 (PST) Organization: http://groups.google.com Message-ID: <25043081.79.1322185079284.JavaMail.geo-discussion-forums@yqmm19> References: <30604696.94.1322013045135.JavaMail.geo-discussion-forums@yqzz20> Reply-To: comp.lang.ada@googlegroups.com NNTP-Posting-Host: 189.110.14.179 Mime-Version: 1.0 X-Trace: posting.google.com 1322185079 13408 127.0.0.1 (25 Nov 2011 01:37:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 25 Nov 2011 01:37:59 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=189.110.14.179; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu User-Agent: G2/1.0 X-Google-Web-Client: true Xref: news1.google.com comp.lang.ada:19131 Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-11-24T17:37:59-08:00 List-Id: > Are you by any chance trying something like the RAII pattern in C++? > (which as far as I can see, stands for "automatic destruction is orderly > shutdown") Yes, something like this. > If so, I think I'm with Dmitry, in that Controlled (or > Limited_Controlled) give you the tools to automate the process. > So your approach (2) is correct; you must stop the task before > deallocating it. However your class user doesn't need to know that, > because you can put the detail in Finalize. (which, if Simon is right, > may need to become a little more complex) At this point it's not a big issue if the task knows the details. But the finalization timing concerns me a little. No problem if a task gets stuck when other is running, but I intend to run thousands of them in parallel, so I need to ensure this.