comp.lang.ada
 help / color / mirror / Atom feed
From: Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject: Re: passing messages between the tasks
Date: Tue, 14 Oct 2014 19:49:10 -0400
Date: 2014-10-14T19:49:10-04:00	[thread overview]
Message-ID: <jrcr3ah1osn5gktan2tn41c2css9ekofn1@4ax.com> (raw)
In-Reply-To: 9fa74920-0bb1-49d4-93ac-f781529f0c98@googlegroups.com

On Tue, 14 Oct 2014 14:08:08 -0700 (PDT), compguy45@gmail.com declaimed the
following:

> 15       accept reset(id : Integer) do

> 23
> 24 begin
> 25    lamps(1).reset(id => 1);

	Note that this scheme has nothing that prevents one doing

	lamps(1).reset(id => 3);

	You'd be better off with something where the tasks first wait for an
initialization rendezvous. (PSEUDO_CODE)

	for i in lamps'range loop
		lamp(i).init(id => i);
	end loop;

	Then later you rendezvous on your reset with just

	lamp(1).reset;

as the lamp(1) task already knows its id from the init() point.

>I am trying to figure out how to do following....have say main tasks call reset on say lamps(3).reset....
>Then lamp(3) would call reset on lamps(2) and lamps(1) and wait....then someone lamps(2) and lamps(1) when they done with reset would somehow let lamp(3) know about it....Is this possible to do...?

	You need to develop a data structure of some sort in which you TELL
each task which tasks are subordinate to it... Which likely means using
access to task.

	And a rendezvous doesn't continue until the accept block exits, so if
all action takes place in the accepts there is no explicit need to wait.

	accept reset do
		subordinate(1).reset;
		subordinate(2).reset;
	end reset;

Whereas if you had

	accept reset do
		Null;
	end reset;
	subordinate(1).reset;
	subordinate(2).reset;

the task would wait for a reset invocation, but the rendezvous would end,
letting the invoker continue -- and then would do the subordinate task
resets.

-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

  parent reply	other threads:[~2014-10-14 23:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-14  1:17 passing messages between the tasks compguy45
2014-10-14  1:49 ` Adam Beneschan
2014-10-14  1:55   ` compguy45
2014-10-14  2:09   ` compguy45
2014-10-14  2:14     ` Adam Beneschan
2014-10-14  2:15       ` compguy45
2014-10-14  7:36         ` mockturtle
2014-10-14 15:30           ` compguy45
2014-10-14 16:25             ` mockturtle
2014-10-14 20:33             ` Shark8
2014-10-14 19:43   ` Shark8
2014-10-14 20:42     ` Jeffrey Carter
2014-10-14 21:08       ` compguy45
2014-10-14 21:58         ` compguy45
2014-10-14 23:03           ` Jeffrey Carter
2014-10-14 22:22         ` Shark8
2014-10-14 23:49         ` Dennis Lee Bieber [this message]
2014-10-15  1:07         ` Dennis Lee Bieber
replies disabled

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