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 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-30 20:01:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!enews.sgi.com!newshub2.rdc1.sfba.home.com!news.home.com!news1.sttln1.wa.home.com.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <3C07DE0D.B5B1C77B@9online.fr> Subject: Re: Protected Object: little question X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: Date: Sat, 01 Dec 2001 04:00:39 GMT NNTP-Posting-Host: 24.248.56.237 X-Complaints-To: abuse@home.net X-Trace: news1.sttln1.wa.home.com 1007179239 24.248.56.237 (Fri, 30 Nov 2001 20:00:39 PST) NNTP-Posting-Date: Fri, 30 Nov 2001 20:00:39 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:17266 Date: 2001-12-01T04:00:39+00:00 List-Id: "Dale Stanbrough" wrote in message news:dstanbro-CBB8ED.08132901122001@mec2.bigpond.net.au... > Bruno Hergott wrote: > > > 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". [snip] > > What do you want it to do with the value you have read? I'm not sure > why you want to "read" a value, but not do anything with the value > you have read. I think he's saying that he has an operation that he wants to read (but not update) state inside the PO, but it doesn't need to return anything out of the PO. Because the operation doesn't update protected state, he doesn't need the exclusive (writer) access that a protected procedure gets. He only needs concurrent (reader) access, i.e. protected against writers but not other readers -- the kind of access that protected functions have. Question for the O.P.: Why can't you write your operation outside the PO, and have a protected function that just returns the information the operation needs? That is, instead of implementing your abstraction *as* a PO, embed a PO in the implementation of the abstraction. That said, Ada95's use of function vs. procedure this way does seem a bit specious, maybe it was a "for lack of a better way" kind of solution. But I haven't read the mapping documents etc. so I have to withhold judgement :-) -- mark