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: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Termination of tasks waiting on a protected queue Date: Sun, 18 May 2014 10:16:48 -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 17:16:50 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="42ea65963a295dd28559459f9f96c6a5"; logging-data="24495"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+wKFfEbkW/MAnP/hE8Kwxkg/+dxGxr5HU=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: Cancel-Lock: sha1:KxJHUBmMDWSn7FHypRXVm0jSgNE= Xref: news.eternal-september.org comp.lang.ada:19882 Date: 2014-05-18T10:16:48-07:00 List-Id: On 05/18/2014 12:32 AM, Natasha Kerensikova wrote: > > I have been having a task termination issue, and I'm wondering whether I > got my design wrong or whether I'm missing something, so I ask you to > help me on that. > > The basic need is delegating potentially long jobs to a dedicated task > (or pool of tasks) so that the program flow generating the jobs and > continue quickly. I furthermore assume that the jobs are "fire and > forget", that there is no need to report anything about completion (or > lack of thereof) to the code that generated the jobs (or more > realistically, that reporting is performed through channels outside of > the scope of the problem). 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. The tasks looked like Forever : loop select Job_Queue.Get (Item => Info); Process (Info => Info); or delay Check_Interval; exit Forever when Control.Finalizing; end select; end loop Forever; Obviously not Ravenscar compliant. Check_Interval was quite long, 2 seconds. -- 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