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.ams3.giganews.com!backlog4.nntp.ams3.giganews.com!backlog4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!rt.uk.eu.org!eternal-september.org!feeder.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: Mon, 19 May 2014 07:28:02 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Injection-Date: Mon, 19 May 2014 07:28:02 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="76a49b86bc3e16725b7cfca3d85cb4c8"; logging-data="25118"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+CkvgxWIc9Q0QiOI7hI83f" User-Agent: slrn/1.0.1 (FreeBSD) Cancel-Lock: sha1:zrB0WBMsU/PrNdAM79v7i/qz9dw= X-Original-Bytes: 2273 Xref: number.nntp.dca.giganews.com comp.lang.ada:186478 Date: 2014-05-19T07:28:02+00:00 List-Id: Hello, On 2014-05-18, Brad Moore wrote: > I was faced with a similar problem in the non-Ravenscar task pools in > Paraffin. > > I did not want the programmer to have to call some protected subprogram > to trigger the task pool to terminate. I also did not want to have to > wait for a timeout to expire before the application could exit. I wanted > it to be immediate. That looks indeed very similar to what I had in mind. > So in your example, it might look something like; Your example is exactly what I was looking for when posting here. Thanks a lot! However I'm considering merging the functionalities of Worker_Idle, Is_Empty and Get_Next into a single protected procedure. Something like procedure Get_Next (Job : out Job_Description; Idle : out Boolean) is begin if List.Is_Empty then Idle := True; Queue.Idle := True; else Job := List.First_Element; List.Delete_First; end if; end Get_Next; But then the solution is a bit more difficult to scale to multiple worker tasks. Maybe with an array of Boolean for Idle. Fortunately I don't have to deal with that for now. Thanks again for the solution, Natasha