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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.173.227 with SMTP id m96mr13355447ioo.70.1520316035649; Mon, 05 Mar 2018 22:00:35 -0800 (PST) X-Received: by 10.157.95.23 with SMTP id f23mr329814oti.12.1520316035457; Mon, 05 Mar 2018 22:00:35 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!w142no1623532ita.0!news-out.google.com!a25ni4774itj.0!nntp.google.com!w142no1623530ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 5 Mar 2018 22:00:35 -0800 (PST) In-Reply-To: <652df156-cec8-4417-ac0c-bed50c163a86@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8303:2100:7466:f44c:da21:40b1; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8303:2100:7466:f44c:da21:40b1 References: <90838aa0-bd51-4913-b0cf-1ded5024c151@googlegroups.com> <652df156-cec8-4417-ac0c-bed50c163a86@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <86a024f2-75f7-4969-ba10-bd600d1d6ecd@googlegroups.com> Subject: Re: multiple delay alternative From: Robert Eachus Injection-Date: Tue, 06 Mar 2018 06:00:35 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3716 X-Received-Body-CRC: 2385355735 Xref: reader02.eternal-september.org comp.lang.ada:50829 Date: 2018-03-05T22:00:35-08:00 List-Id: On Monday, March 5, 2018 at 8:50:51 PM UTC-5, Mehdi Saada wrote: > Before that, one thing I can't get, even after asking other people: > for protected objects, in a protected procedure, when it's blocked, becau= se a reading (protected function) or an entry is being served, are the call= s to the procedure put on a queue as with entries ? > Someone said me the advantage of protected procedures was that you don't = have to wait, but I read also they were exclusive with each others... damn. If a task calls an entry of a protected object, and has to wait, it waits, = if you will, before the entry. You can use select statements to wait, or e= ven abandon the entry call immediately. For subprograms of a protected obj= ect, the call is evaluated immediately, even if the protected object is bus= y. Then procedure calls are executed sequentially. After each protected a= ction the entry queues are checked. If a protected function call is active= , all waiting function calls (again parameters evaluated immediately) are e= xecuted simultaneously before the entry queues are again checked. Randy, is this right for the default rules? I never bother because 9.5.1 (= 8..18) and the following notes mean I need to get the behavior right for we= ll spaced calls, and the implementation will sort races however they fall o= ut. In other words, I can't really tell what order things happen in the ca= se of truly simultaneous calls from different tasks--and CPU cores. All I = get is that the invariants and pre- and post- conditions hold. The invariants are: 1) Only one entry or externally called procedure can be active at any point= in time. 2) An entry or externally called procedure can call (internally) other proc= edures or functions without blocking. 3) If an externally called function is active, many other function calls ca= n (in theory) be active, but no procedure or entry calls. 4) The state of the protected object (internal variables) cannot be changed= by a function call. However, local variables in the function can change, = for example the index of a loop statement. If you want to design complex protected objects, another important point/go= tcha is that "potentially blocking" actions shouldn't occur within the prot= ected body. That effectively limits you to fairly standard synchronizing c= onstructs. The examples at the bottom of 9.4 are a good place to start.