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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e8e240cec570cdf2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-18 11:13:09 PST Path: supernews.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison Sender: usenet@www.newsranger.com References: <9bkevj$61k$1@nh.pace.co.uk> Subject: Re: Multiple entry tasks Message-ID: Date: Wed, 18 Apr 2001 18:12:43 GMT NNTP-Posting-Host: 209.208.22.130 X-Complaints-To: abuse@newsranger.com X-Trace: www.newsranger.com 987617563 209.208.22.130 (Wed, 18 Apr 2001 14:12:43 EDT) NNTP-Posting-Date: Wed, 18 Apr 2001 14:12:43 EDT Organization: http://www.newsranger.com Xref: supernews.google.com comp.lang.ada:6981 Date: 2001-04-18T18:12:43+00:00 List-Id: 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