comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Combining entry_call, accept_statment and terminate_statment
Date: Mon, 29 Mar 2004 16:04:49 -0600
Date: 2004-03-29T16:04:49-06:00	[thread overview]
Message-ID: <106h7clrs4iio8c@corp.supernews.com> (raw)
In-Reply-To: slrnc6guve.g7p.lutz@belenus.iks-jena.de

"Lutz Donnerhacke" <lutz@iks-jena.de> wrote in message
news:slrnc6guve.g7p.lutz@belenus.iks-jena.de...
> Unfortunly this is not allowed. Either accept and terminate or an
entry_call
> and a delay can be combinded. I wonder how to solve such as deadlock. It
> should be a common idiom, but I had no luck in choosing searching
keywords.

I can't tell you how to work around it, but I can tell you why it's not
allowed - the implementation would be very slow.

During the Ada 9X process, there was a proposal for a multi-way entry call.
(A more limited version of what you're asking for here.) The three
User-Implementer teams were asked to analyze the implementation effort. (The
reports are somewhere in the AdaIC archives, if you're interested.) All
three teams decided that the run-time cost of the feature would be high (it
would be close to polling). Since the real-time users that were requesting
the feature need high performance, it was eventually dropped as impractical.

I recently ran into a similar problem. All I wanted was an entry call with
terminate. The (ugly) solution I used was to add an explicit Quit entry to
the task, and I changed the select into a polling loop:

    loop
         select
             accept Quit;
             exit;
         else null;
         end select;
         select
             PO.Get_New_Operation (...);
             Do_Operation (...);
         or
             delay 0.06;
         end select;
    end loop;

That's effectively what the implementation of such a select would have to do
anyway, so there's not much extra cost.

But I'd say that you probably have a design problem if you have a task that
is both calling and accepting at the same time. That's pretty weird (unless
the accepts are purely for task control, as above). It's preferable that
each task be either a server (accepting entries) or a client (calling
entries), but not both. Analysis is complicated if you have both.

                      Randy.






  reply	other threads:[~2004-03-29 22:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-29 19:41 Combining entry_call, accept_statment and terminate_statment Lutz Donnerhacke
2004-03-29 22:04 ` Randy Brukardt [this message]
2004-03-29 23:19   ` Mark Lorenzen
2004-03-29 23:14     ` Robert I. Eachus
2004-03-30  7:26   ` Lutz Donnerhacke
2004-03-30 20:04     ` Randy Brukardt
2004-03-30 22:47       ` Lutz Donnerhacke
2004-03-31  9:03         ` Dmitry A. Kazakov
2004-03-31  9:14           ` Lutz Donnerhacke
2004-03-31 12:22             ` Dmitry A. Kazakov
2004-03-31  6:39       ` Jean-Pierre Rosen
2004-03-30  7:29   ` Lutz Donnerhacke
2004-03-30  8:11     ` tmoran
2004-03-30 11:45     ` Lutz Donnerhacke
2004-03-30  0:33 ` James Rogers
replies disabled

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