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,dcda92e2d95aeec,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-30 11:29:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fr.clara.net!heighliner.fr.clara.net!teaser.fr!alecto.grec.isp.9tel.net!not-for-mail From: Bruno Hergott Newsgroups: comp.lang.ada Subject: Protected Object: little question Date: Fri, 30 Nov 2001 20:29:17 +0100 Organization: 9Telecom Message-ID: <3C07DE0D.B5B1C77B@9online.fr> NNTP-Posting-Host: massy-2-2-2-132.dial.9tel.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: apollon.grec.isp.9tel.net 1007148573 8445 212.30.105.132 (30 Nov 2001 19:29:33 GMT) X-Complaints-To: abuse@isp.9tel.net NNTP-Posting-Date: Fri, 30 Nov 2001 19:29:33 +0000 (UTC) X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:17237 Date: 2001-11-30T20:29:17+01:00 List-Id: Hello, Protected Object is really helpfull to provide read and/or write access to a ressource in a multitask environnement. I think i have understand the basis but something remains strange for me. Before all, it could be better to write there the RM Ch. 9. 5.1 concerning protected objects: (1): A protected subprogram is a subprogram declared immediately within a protected_definition. Protected procedures provide exclusive read-write access to the data of a protected object; protected functions provide concurrent read-only access to the data. (2): Within the body of a protected function (or a function declared immediately within a protected_body), the current instance of the enclosing protected unit is defined to be a constant (that is, its subcomponents may be read but not updated). Within the body of a protected procedure (or a procedure declared immediately within a protected_body), and within an entry_body, the current instance is defined to be a variable (updating is permitted). (4) A new protected action is not started on a protected object while another protected action on the same protected object is underway, unless both actions are the result of a call on a protected function. This rule is expressible in terms of the execution resource associated with the protected object : - (5) Starting a protected action on a protected object corresponds to acquiring the execution resource associated with the protected object, either for concurrent read-only access if the protected action is for a call on a protected function, or for exclusive read-write access otherwise; - (6) Completing the protected action corresponds to releasing the associated execution resource. ... My question is: If i want to implement an action wich does only read access to the protected data and wich can be called by 2 tasks at the same time, i must write a function. But i may not need the return value of this function. Because what i want is not really a function. What i want is "the thing in a protected object to do only read access to the protected data and wich can be called by 2 tasks at the same time". And so i must for example call this action like this: My_Boolean_Return_Value_I_Dont_Want := My_Protected_Object.MyProtectedFunction(..); It seems to strange to be true... Or is there something i haven't understand ?