From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Task safe containers? Help needed.
Date: Sun, 8 Oct 2017 08:57:14 +0200
Date: 2017-10-08T08:57:14+02:00 [thread overview]
Message-ID: <orci8c$mpl$1@gioia.aioe.org> (raw)
In-Reply-To: a153a7e8-4108-4c81-b211-a59c380113d5@googlegroups.com
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
next prev parent reply other threads:[~2017-10-08 6:57 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 [this message]
2017-10-08 15:10 ` reinert
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