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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a6fa29aa44e074d8,start X-Google-Attributes: gid103376,public From: smize@news.imagin.net (Samuel Mize) Subject: Can a protected action tie up the calling task? Date: 1997/10/27 Message-ID: <6331fk$nm0$1@prime.imagin.net>#1/1 X-Deja-AN: 285449605 Organization: ImagiNet Communications Ltd, Arlington, Texas Reply-To: smize@imagin.net (Samuel Mize) Newsgroups: comp.lang.ada Date: 1997-10-27T00:00:00+00:00 List-Id: Greetings, I need to verify a point on how protected actions work. Please email me, as my news feed provides *very* variable delays. My understanding is that, after an entry or procedure completes, the queues for that object are serviced as far as possible before the protected action completes. This is done by any convenient thread of control (ARM 9.5.3(22)). This permission ALLOWS but does not REQUIRE that the task calling the entry or procedure be released before the protected action completes. Thus, in the following example, if another task has already called Complete before task T1 calls Prepare: - T1's thread of control can execute Complete; - this COULD keep T1 suspended until Complete terminates. Example: protected Monitor is entry Prepare (D: in Data); entry Complete; private Ready_To_Complete: boolean := false; end Monitor; protected body Monitor is entry Prepare (D: in Data) when not Ready_To_Complete is ... entry Complete when Ready_To_Complete is ... end Monitor; So to ENSURE that T1 can continue processing IMMEDIATELY on completion of Prepare, we must ensure that Complete is not called before Prepare. A third entry is probably the simplest way to do this (task T2 calls Wait_For_Preparation, then Complete). protected Monitor is entry Prepare (D: in Data); entry Wait_For_Preparation; procedure Complete; private Ready_To_Complete: boolean := false; end Monitor; protected body Monitor is entry Prepare (D: in Data) when not Ready_To_Complete is ... entry Wait_For_Preparation when Ready_To_Complete is ... procedure Complete is ... end Monitor; Is this correct? Have I missed something? Thanks, Sam Mize -- Samuel Mize -- smize@imagin.net -- Team Ada (personal net account)