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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: Termination of tasks waiting on a protected queue Date: Sun, 18 May 2014 19:54:16 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Injection-Date: Sun, 18 May 2014 19:54:16 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="76a49b86bc3e16725b7cfca3d85cb4c8"; logging-data="22427"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DCYVYdCkBQMngs0WV1YFp" User-Agent: slrn/1.0.1 (FreeBSD) Cancel-Lock: sha1:Qrdu91Ui2EdbqRuNDiIpK9uKyP8= Xref: news.eternal-september.org comp.lang.ada:19888 Date: 2014-05-18T19:54:16+00:00 List-Id: Hello, On 2014-05-18, Jeffrey Carter wrote: > I have done something similar for pools of worker tasks. I used an > instance of PragmARC.Queue_Unbounded_Blocking to hold the job requests > rather than rolling my own for each task pool. The solution to > termination was to use a timed entry call to the queue, with another > protected object with a function to indicate if the pool tasks should > end. That's a solution I considered, along with the idea of outputing a special value in the blocking protected entry to indicate that tasks should end (choosing between both solutions depending on how unnatural adding the shutdown order to the queue is, and how badly I want the termination order to be immediate). But I haven't managed to design a robust way of triggering the indication that tasks should end. 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? > Obviously not Ravenscar compliant. Well Ravenscar was only involved in my coming up with such a solution. As soon as I'm thinking about task termination, I'm leaving Ravenscar realm anyway. Thanks for your help, Natasha