From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 23 Sep 92 17:49:11 GMT From: visicom!amstel!rlk@nosc.mil (Bob Kitzberger) Subject: Re: conditional entry call ? Message-ID: List-Id: shengru@cs.uno.edu (Shengru Tu) writes: >I know that a typical conditional entry call can be: > ... > select > TASK_NAME.ENTRY_NAME; > ... > or > delay 10.0; > end select; Actually that's a timed entry call [ARM 9.7.3]. A conditional entry call [ARM 9.7.2] is: select entry_call_statement [sequence_of_statements] else sequence_of_statements end select; >But is the following code legal, where I put another entry call stmt in >the position of "stmt": > ... > select > T2.E2; > or > T3.E3; > end select; > ... No, it's illegal (see ARM 9.7.3: the second alternative must be a delay alternative). You may be thinking of: select T2.E2; else T3.E3; end select; In which case, by ARM 9.7.2, the first alternative's entry call will be cancelled if not immediately possible, and the 'else' alternative will be followed. This can be any sequence of statements, but since it's an entry call it will behave as a stand-alone entry call, and waits for rendezvous with T3.E3. If, while blocked on the T3.E3 entry call, task T2 hits the accept for E2, it's tough cookies since the select alternative has already been evaluated. It may be that what you are asking for in a multi-way entry call (the counterpart to a selective wait). As far as I know, it can't be done in Ada 83. Does anybody have a multi-way entry call solution? .Bob. with text_io; use text_io; procedure test is task t is entry a; entry b; end t; task body t is begin accept a do put_line( "a"); end a; accept b do put_line( "b"); end b; delay 1.0; -- make sure first select alternative is evaulated accept a do put_line( "a"); end a; end t; begin select t.a; -- immediately succeeds else t.b; end select; select t.a; -- not possible, call t.b else t.b; -- succeeds end select; select t.a; -- not possible, call t.b else t.b; -- stuck calling b here end select; end test; ---------------- Bob Kitzberger VisiCom Laboratories, Inc. rlk@visicom.com 10052 Mesa Ridge Court, San Diego CA 92121 USA +1 619 457 2111 FAX +1 619 457 0888