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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Termination of tasks waiting on a protected queue Date: Tue, 20 May 2014 09:54:38 +0200 Organization: cbb software GmbH Message-ID: References: <3ab5fcf0-d2a8-4c82-ab51-02b829aebcaa@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: QTaafVZuunHujkJPndFR7g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 2432 Xref: number.nntp.dca.giganews.com comp.lang.ada:186500 Date: 2014-05-20T09:54:38+02:00 List-Id: On Mon, 19 May 2014 16:49:29 -0500, Randy Brukardt wrote: > wrote in message > news:3ab5fcf0-d2a8-4c82-ab51-02b829aebcaa@googlegroups.com... >> It has always seemed strange that Ada doesn't seem to have a way to block >> on 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 suspension objects. > > There was such a proposal for Ada 9x. After much discussion, a report was > commissioned from the three user-implementor teams. All three reported that > the operation would be much more expensive to implement than it appears on > the surface. In particular, the people with hard real-time deadlines could > not use any imaginable implementation of the feature -- which would have > made it useless to the #1 constituency. The idea was dropped and never has > been raised since. For the OP problem, which is quite common, it would be enough to allow single terminate alternative in select. Then code could be written as: task body Worker is Job : Job_Description; begin loop select Queue.Get_Next (Job); -- Do the job or delay 1.0; end select; select -- This is not Ada! terminate; else exit; end select; end loop; end Worker; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de