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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.28.136 with SMTP id b8mr14267781obh.19.1400438550704; Sun, 18 May 2014 11:42:30 -0700 (PDT) X-Received: by 10.140.44.75 with SMTP id f69mr2029qga.11.1400438550599; Sun, 18 May 2014 11:42:30 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.bbs-scene.org!xmission!news.glorb.com!hl10no929384igb.0!news-out.google.com!qf4ni2017igc.0!nntp.google.com!c1no9888695igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 18 May 2014 11:42:30 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=206.53.78.59; posting-account=ShYTIAoAAABytvcS76ZrG9GdaV-nXYKy NNTP-Posting-Host: 206.53.78.59 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3ab5fcf0-d2a8-4c82-ab51-02b829aebcaa@googlegroups.com> Subject: Re: Termination of tasks waiting on a protected queue From: sbelmont700@gmail.com Injection-Date: Sun, 18 May 2014 18:42:30 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:19884 Date: 2014-05-18T11:42:30-07:00 List-Id: My preferred method is to not queue the data type, per say, but a discrimin= ated record that is either a 'data' or 'exit', with the former containing t= he item and the latter containing nothing. The producers then post an 'exi= t' item when it's time to shut down, that the consumers then use to exit th= e loop: begin loop Blocking_Dequeue(x); exit when x.type =3D=3D Shutdown; Do_Something (x.data); end loop; end; The problem is making it exception proof, since finalization can't be used = to do it automatically. It has always seemed strange that Ada doesn't seem to have a way to block o= n multiple entries, in line with posix select() or waitformultipleobjects. = I'd be happy with even just a function that can wait on an array of suspen= sion objects. -sb