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.8.9 with SMTP id 9mr7445459ioi.6.1472333777065; Sat, 27 Aug 2016 14:36:17 -0700 (PDT) X-Received: by 10.157.20.143 with SMTP id d15mr727098ote.1.1472333777046; Sat, 27 Aug 2016 14:36:17 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!x131no508385ite.0!news-out.google.com!d68ni41032ith.0!nntp.google.com!j128no507878ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 27 Aug 2016 14:36:16 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=50.250.26.106; posting-account=3pYsyQoAAACcI-ym7XtMOI2PDU8gRZS5 NNTP-Posting-Host: 50.250.26.106 References: <35ae841e-5947-44e9-a8d4-479cf40c4277@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7b1bb0e6-6a87-476a-978f-dbfec7bb638a@googlegroups.com> Subject: Re: How to simulate semaphores with Ada's tasks? From: Andrew Shvets Injection-Date: Sat, 27 Aug 2016 21:36:17 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:31613 Date: 2016-08-27T14:36:16-07:00 List-Id: On Wednesday, August 24, 2016 at 9:04:50 PM UTC-4, Jeffrey R. Carter wrote: >=20 > Yes, you use protected objects. >=20 > --=20 > Jeff Carter > "He had no conception of the instrument. He > was blowing into it." > Take the Money and Run > 135 Hello Jeff, I do have a question now. I've written an (at the bottom of this message) = example on using a protected type. My current understanding is that the protected type is a way to encapsulate= a piece of data and then regulate which values can be assigned its insides= (similar to how in Java there is a way to create a piece of code where onl= y one thread at a time can run at any given moment.) The example below has= 5 tasks and each one tries to update the same unbounded string. The goal = was to create a small application with 5 tasks and each one fighting to upd= ate the same value. Does my description make sense? Or am I completely off-base? https://gist.githubusercontent.com/anonymous/c8eee56143d534d837281953d86ac5= 01/raw/cd2603babab42132cea68f71997960dd925fc4e8/gistfile1.txt