comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthewjheaney@earthlink.net>
Subject: Re: Multitasking and containers
Date: Fri, 24 Nov 2006 12:12:13 GMT
Date: 2006-11-24T12:12:13+00:00	[thread overview]
Message-ID: <ud57dhwme.fsf@earthlink.net> (raw)
In-Reply-To: ek6hsv$t1o$1@cernne03.cern.ch

Maciej Sobczak <no.spam@no.spam.com> writes:

> That would be interesting, but would break apart when encapsulated within a
> protected object, because there multiple readers would be allowed.

But I think that's true only when multiple readers are calling protected
functions.  (There is a subtle difference in semantics between protected
functions and protected procedures.)  It does seem you'd need to use a
protected procedure when manipulating a container nested inside a protected
object, since a protected function wouldn't provide the level of
synchronization required.


> Having a mutex for readers sounds like a concurrency killer and relying on
> protected wrappers seems to be fragile because of this possible
> mutability. So - what is The Solution (tm) for multiple tasks reading from
> the same container?

Declare the container object inside a protected object, and use protected
procedures to manipulate the container.  Protected wrappers should be fine, as
long as you use protected procedures, not protected functions.


> Let's say you want to have N worker tasks consulting a shared dictionary
> (map) that was initialized before the tasks started their work. How would you
> solve this?

As above: declare the container object inside a protected object, and use
protected procedures to manipulate the container.



  parent reply	other threads:[~2006-11-24 12:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-24  8:51 Multitasking and containers Maciej Sobczak
2006-11-24 10:11 ` Georg Bauhaus
2006-11-24 10:19 ` Dmitry A. Kazakov
2006-11-24 10:35   ` Maciej Sobczak
2006-11-24 11:14     ` Dmitry A. Kazakov
2006-11-24 12:13       ` Matthew Heaney
2006-11-27  4:17         ` Jeffrey R. Carter
2006-11-27 10:30           ` Georg Bauhaus
2006-11-27 18:41             ` Jeffrey R. Carter
2006-11-27 18:57               ` Dmitry A. Kazakov
2006-11-27 19:45               ` Matthew Heaney
2006-11-27 21:15                 ` Simon Wright
2006-11-28  1:43                 ` Dr. Adrian Wrigley
2006-11-28  2:19                   ` Matthew Heaney
2006-11-28  8:50                     ` Dmitry A. Kazakov
2006-11-28 10:31                       ` Georg Bauhaus
2006-11-28 11:24                         ` Dmitry A. Kazakov
2006-11-29  8:51                           ` Georg Bauhaus
2006-11-28 17:12                       ` Matthew Heaney
2006-11-28 18:21                         ` Dmitry A. Kazakov
2006-11-28 19:17                           ` Matthew Heaney
2006-11-29 18:43                             ` Dmitry A. Kazakov
2006-11-29 10:14                       ` Maciej Sobczak
2006-11-29 15:50                         ` Matthew Heaney
2006-11-24 12:12     ` Matthew Heaney [this message]
2006-11-24 12:05   ` Matthew Heaney
2006-11-24 12:02 ` Matthew Heaney
replies disabled

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