comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: How to: communication between multiple tasks using protected objects - with no polling?
Date: Fri, 23 Jan 2015 09:25:14 +0100
Date: 2015-01-23T09:25:14+01:00	[thread overview]
Message-ID: <16hj52m3z7o4u$.89sc4sp3d4eo$.dlg@40tude.net> (raw)
In-Reply-To: 204973896443655271.096946nonlegitur-futureapps.invalid@reader80.eternal-september.org

On Thu, 22 Jan 2015 21:52:17 +0000 (UTC), G.B. wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote:
>> On Wed, 21 Jan 2015 19:56:17 +0100, Jacob Sparre Andersen wrote:
> 
>>> To me it sounds like a single protected object for storing the state of
>>> all the workers (students) makes most sense.  The workers can push in
>>> their most recent state through a (common) protected procedure.  The
>>> master (teacher) blocks on a protected entry until at least one worker
>>> has updated its state.
>> 
>> Right, though this works only with a single subscriber (the teacher).
>> Usually there are more than one .
> 
> The PO and the teacher task(s) could share a suspension
> object (one for each teacher). When the PO has collected
> enough items, it calls Set_True on some suspension
> object to wake the teacher task up.

You missed the point. The scenario I was talking about is a queue, e.g. a
FIFO, which can be implemented using a PO. But a queue is fundamentally a
n-1 scenario, because getting an element from the queue is a destructive
operation, it changes the queue state. In fact, the queue's state is the
state of the subscriber. With multiple subscribers there is no way to tell
which one's state is the queue state. You need the get operation idempotent
and have the subscribers keeping the states of their own.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2015-01-23  8:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 22:36 How to: communication between multiple tasks using protected objects - with no polling? Esa Riihonen
2015-01-21  0:19 ` Hubert
2015-01-21 16:53   ` Esa Riihonen
2015-01-21 23:22     ` Hubert
2015-01-22 13:24       ` Esa Riihonen
2015-01-21  0:47 ` Jeffrey Carter
2015-01-21  8:11   ` Simon Wright
2015-01-21 17:16   ` Esa Riihonen
2015-01-21 18:39     ` Jeffrey Carter
2015-01-22 13:32       ` Esa Riihonen
2015-01-21  8:28 ` Dmitry A. Kazakov
2015-01-21 17:34   ` Esa Riihonen
2015-01-21 18:56     ` Jacob Sparre Andersen
2015-01-21 20:15       ` Dmitry A. Kazakov
2015-01-22 21:52         ` G.B.
2015-01-23  8:25           ` Dmitry A. Kazakov [this message]
2015-01-21 20:02     ` Dmitry A. Kazakov
2015-01-22 13:37       ` Esa Riihonen
replies disabled

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