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: 1108a1,2c6139ce13be9980 X-Google-Attributes: gid1108a1,public X-Google-Thread: fac41,2c6139ce13be9980 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,3d3f20d31be1c33a X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,2c6139ce13be9980 X-Google-Attributes: gidf43e6,public From: Samuel Mize Subject: Re: Safety-critical development in Ada and Eiffel Date: 1997/08/13 Message-ID: <33F20113.738F@link.com>#1/1 X-Deja-AN: 263965894 References: Organization: Hughes Training Inc. Reply-To: smize@link.com Newsgroups: comp.object,comp.software-eng,comp.lang.ada,comp.lang.eiffel Date: 1997-08-13T00:00:00+00:00 List-Id: Don Harrison wrote: > > Jon S Anthony wrote: [about Ada protected objects] > :The objects can be unlocked for > :_read_ access, but never for any update access. > > Care to give an example? "Locked" is a common term, but its application to Ada is not defined by the Ada Reference Manual (ARM), so it may be unclear or accidentally misleading. The ARM refers to protected operations being "blocked" if they cannot "acquire" the "execution resource associated with a protected object" (ARM 9.4(18)). "Protected procedures provide exclusive read-write access to ... a protected object; protected functions provide concurrent read-only access" (ARM 9.5.1 (1)). For one protected object, "a new protected action is not started ... while another ... is underway, unless both actions are the result of a call on a protected function." (ARM 9.5.1(4)). In other words, a protected object can have functions and procedures (treating entries are a type of procedure). A procedure can't start while a function is executing, but a function can; nothing else can start while a procedure is executing. During an operation on the object that can change its value (a procedure), you can't "unlock" the object for others to read. However, an operation that can't change the object's value (a function) does NOT acquire an exclusive lock, just a read lock. Sam Mize