comp.lang.ada
 help / color / mirror / Atom feed
From: Andrew Shvets <andrew.shvets@gmail.com>
Subject: Re: How to simulate semaphores with Ada's tasks?
Date: Sat, 27 Aug 2016 14:36:16 -0700 (PDT)
Date: 2016-08-27T14:36:16-07:00	[thread overview]
Message-ID: <7b1bb0e6-6a87-476a-978f-dbfec7bb638a@googlegroups.com> (raw)
In-Reply-To: <nplg7f$5st$1@dont-email.me>

On Wednesday, August 24, 2016 at 9:04:50 PM UTC-4, Jeffrey R. Carter wrote:
> 
> Yes, you use protected objects.
> 
> -- 
> 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 only 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 update the same value.

Does my description make sense?  Or am I completely off-base?

https://gist.githubusercontent.com/anonymous/c8eee56143d534d837281953d86ac501/raw/cd2603babab42132cea68f71997960dd925fc4e8/gistfile1.txt


  parent reply	other threads:[~2016-08-27 21:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25  0:41 How to simulate semaphores with Ada's tasks? Andrew Shvets
2016-08-25  1:04 ` Jeffrey R. Carter
2016-08-25  1:44   ` Andrew Shvets
2016-08-27 21:36   ` Andrew Shvets [this message]
2016-08-28  1:04     ` Jeffrey R. Carter
2016-08-28  1:59       ` Andrew Shvets
2016-08-25  7:39 ` Dmitry A. Kazakov
2016-08-27 18:06   ` Andrew Shvets
2016-08-25  7:55 ` G.B.
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox