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=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Termination of tasks waiting on a protected queue Date: Sun, 18 May 2014 14:54:13 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 18 May 2014 21:54:15 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="42ea65963a295dd28559459f9f96c6a5"; logging-data="14242"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QEWObVbDr+GLjsEC3A9xkAh1fYC7EIHo=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: Cancel-Lock: sha1:KT3cF/qI9kbaxuhKR6Yig5HclPI= X-Original-Bytes: 2647 Xref: number.nntp.dca.giganews.com comp.lang.ada:186473 Date: 2014-05-18T14:54:13-07:00 List-Id: On 05/18/2014 12:54 PM, Natasha Kerensikova wrote: > > This is a library-level queue and a library level task providing a > service to the whole application. So there is no object whose > finalization can be used as a trigger for the task shutdown order. > The only solution I see is to provide an explicit Shudown procedure that > sends the task shutdown signal, but it is fragile: what if the client > forgets to call it? or if an exception make control flow jump around it? > and what if the client calls it too early, and more jobs are added to > the queue? I had no access to the pool tasks once they were created, so calling a task entry was not possible. The Control PO was library level, and was called so the function returned True when the system was shutting down. There were library-level tasks, too, so it wasn't the finalization of a controlled object that made that call. The system knew when it was time to stop. If you don't have that knowledge, then things get interesting. You may have to accept the failings you discuss and push the responsibility off to the client. -- Jeff Carter "If I could find a sheriff who so offends the citizens of Rock Ridge that his very appearance would drive them out of town ... but where would I find such a man? Why am I asking you?" Blazing Saddles 37