comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Termination of tasks waiting on a protected queue
Date: Tue, 20 May 2014 09:54:38 +0200
Date: 2014-05-20T09:54:38+02:00	[thread overview]
Message-ID: <aiwtd3ijroq5.19xvlajoaec2y$.dlg@40tude.net> (raw)
In-Reply-To: lldu9b$46j$1@loke.gir.dk

On Mon, 19 May 2014 16:49:29 -0500, Randy Brukardt wrote:

> <sbelmont700@gmail.com> 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


  reply	other threads:[~2014-05-20  7:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-18  7:32 Termination of tasks waiting on a protected queue Natasha Kerensikova
2014-05-18  9:24 ` anon
2014-05-18 19:43   ` Natasha Kerensikova
2014-05-18 17:16 ` Jeffrey Carter
2014-05-18 19:54   ` Natasha Kerensikova
2014-05-18 21:54     ` Jeffrey Carter
2014-05-18 18:42 ` sbelmont700
2014-05-18 18:48   ` Jeffrey Carter
2014-05-18 20:51     ` sbelmont700
2014-05-18 21:44       ` Jeffrey Carter
2014-05-19 21:49   ` Randy Brukardt
2014-05-20  7:54     ` Dmitry A. Kazakov [this message]
2014-05-20  7:58       ` Dmitry A. Kazakov
2014-05-18 23:05 ` Brad Moore
2014-05-19  7:28   ` Natasha Kerensikova
2014-05-27 11:08   ` Alejandro R. Mosteo
2014-05-28  1:04     ` Brad Moore
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox