comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: Multiple entry tasks
Date: Wed, 18 Apr 2001 18:12:43 GMT
Date: 2001-04-18T18:12:43+00:00	[thread overview]
Message-ID: <vOkD6.1839$D4.178910@www.newsranger.com> (raw)
In-Reply-To: 9bkevj$61k$1@nh.pace.co.uk

In article <9bkevj$61k$1@nh.pace.co.uk>, Marin David Condic says...
>
>*are* trained professionals!), nor have I run this past a compiler (spank me
>for this later if it doesn't work) but I *think* you want some version of
>the following:
>
>select
>    when (Entry2'Count <= 0) and (Entry1'Count <= 0) =>
>        accept Entry3 ;

or 

>    when (Entry1'Count <= 0) =>
>        accept Entry2 ;
>or
>    accept Entry1;
>else
>    terminate;
>end select ;


I don't think the guards get recalcuated when new entries come in, only when the
top of the select statement is reached. Thus if nothing is available then, it
will continue to wait indefinitely for Entry1, even if an Entry2 or Entry3 comes
in later.

One way to get some entries to have priority over others would be to use "pragma
Queuing_Policy (Priority_Queuing);" With that set, the entries will be accepted
in the order of the priority of their tasks. The drawbacks to this are that your
scheme depends on task priorities, which might not mesh well with what you are
trying to do, and that this pragma requires that your compiler supports the
Real-Time annex (D). If you do it this way, you are really prioritizing the
*clients* (rendezvous initiating tasks), not the entires.

An different way, that prioritizes the entries themselves, is to use cascading
select-else structures:

select
accept Entry1;
else
select
accept Entry2;
else
select
accept Entry1;
or
accept Entry2;
or
accept Entry3;
or
terminate;
end select;
end select;
end select;


A third possiblity, that works with a single entry, is to keep track of the
highest priority entry (this part is tricky), and use the "requeue" statement
creatively. How exactly to accomplish this depends a lot on your scheme for
setting and keeping track of priorities, and can get quite interesting, so I
won't burden everyone here with an example (as much as I'd love to. Requeue is
really fun to play with).

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



  reply	other threads:[~2001-04-18 18:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-18 14:57 Multiple entry tasks Lutz Donnerhacke
2001-04-18 16:22 ` Marin David Condic
2001-04-18 18:12   ` Ted Dennison [this message]
2001-04-18 18:57     ` Ted Dennison
2001-04-18 20:16       ` Marin David Condic
2001-04-19 14:02         ` Ted Dennison
2001-04-19 14:28           ` Marin David Condic
2001-04-18 19:46     ` Marin David Condic
2001-04-19 21:52       ` Robert A Duff
2001-04-24  9:19         ` Lutz Donnerhacke
2001-04-19  8:17   ` Jean-Pierre Rosen
2001-04-19 14:42     ` Ted Dennison
2001-04-19 15:01       ` Marin David Condic
2001-04-19 15:02       ` Jean-Pierre Rosen
2001-04-19 19:12         ` Ted Dennison
2001-04-20 14:17           ` Jean-Pierre Rosen
2001-04-20 19:04             ` Ted Dennison
2001-04-23  6:55               ` Jean-Pierre Rosen
2001-04-23 13:50                 ` Ted Dennison
replies disabled

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