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,4bd6ca8f7a1eb225 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.36.6 with SMTP id m6mr11510716pbj.4.1322228428081; Fri, 25 Nov 2011 05:40:28 -0800 (PST) Path: lh20ni16608pbb.0!nntp.google.com!news2.google.com!news.glorb.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Class with task destructor Date: Fri, 25 Nov 2011 13:40:27 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <30604696.94.1322013045135.JavaMail.geo-discussion-forums@yqzz20> <25043081.79.1322185079284.JavaMail.geo-discussion-forums@yqmm19> Mime-Version: 1.0 Injection-Date: Fri, 25 Nov 2011 13:40:27 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="DkTdSjxOCm6DqG+Uf7eArg"; logging-data="28227"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5eKjB3pX4nIK8+Krr4NK/3maL56Ij2aM=" User-Agent: Pan/0.134 (Wait for Me; GIT cb32159 master) Cancel-Lock: sha1:4lJqW/bCAyPwCvB7KBTK/MmbOY8= Xref: news2.google.com comp.lang.ada:14650 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2011-11-25T13:40:27+00:00 List-Id: On Thu, 24 Nov 2011 17:37:59 -0800, Rego, P. wrote: >> 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. > 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. Well your user will simply free a controlled object; either by it going out of scope (if it's on the stack) or an explicit delete. Since it's a controlled object, your "Finalize" is automatically called before the actual memory is released; it is up to you to write "Finalize" to shut the task down properly and only return when this is done. Then the actual deallocation will proceed safely. What is your concern about that sequence? - Brian