comp.lang.ada
 help / color / mirror / Atom feed
From: reinert <reinkor@gmail.com>
Subject: Re: Task safe containers? Help needed.
Date: Sun, 8 Oct 2017 08:10:12 -0700 (PDT)
Date: 2017-10-08T08:10:12-07:00	[thread overview]
Message-ID: <e85dc912-3146-487c-aa02-a7e63f86375e@googlegroups.com> (raw)
In-Reply-To: <orci8c$mpl$1@gioia.aioe.org>

About your first option: Putting the containers in a protected object makes the container functions "private" and not directly available outside the protected object. Right? I like these container functions.

But your other options also somehow complicates :-)

A compromise seems to be necessary :-) Maybe the first option anyway facilitates cleanest code? There must be a reason for the invention of protected types.

reinert

On Sunday, October 8, 2017 at 8:57:18 AM UTC+2, Dmitry A. Kazakov wrote:
> On 2017-10-08 06:27, reinert wrote:
> 
> > if I want to access a container (Vector, Set, Map) by several tasks
> > (updating and reading) - (hopefully) without loosing functionality of
> > the container.
> > 
> > What should I do?
> 
> 1. If operations are short and non-blocking put the container in a 
> protected object and route operations trough object's ones.
> 
> 2. If operations are long, unbounded, blocking (most of the cases):
> 
> 2.a Use a mutex taken at the beginning of each operation and released at 
> the end.
> 
> 2.b Use monitor task owning the container. All operations are performed 
> by the task from task's entries.
> 
> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de


  reply	other threads:[~2017-10-08 15:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-08  4:27 Task safe containers? Help needed reinert
2017-10-08  5:42 ` Niklas Holsti
2017-10-08  6:57 ` Dmitry A. Kazakov
2017-10-08 15:10   ` reinert [this message]
2017-10-08 16:05     ` Dmitry A. Kazakov
2017-10-09  9:18       ` reinert
2017-10-09 21:54   ` Randy Brukardt
2017-10-10  7:25     ` Dmitry A. Kazakov
2017-10-10 19:48       ` Randy Brukardt
replies disabled

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