comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: A common array
Date: 17 Dec 2003 21:25:28 -0500
Date: 2003-12-17T21:25:28-05:00	[thread overview]
Message-ID: <mailman.135.1071714340.31149.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <3fe0d45e$1@news.barak.net.il>

"Ratson Janiv" <janiv@013.net.il> writes:

> I need to write a program that creates a random number of tasks.

Hmm. It usually helps if you tell us what you are _really_ trying to
do; often Ada has a totally different approach than you are used to.

> I need the tasks to update a common array (1 array for all the
> tasks). do I need keep the array updating in critical section (I
> know that each task will update a differnet cell in the array), if
> so how ? 

Put that common array in yet another task, or in a protected object.

> Also I need to write a mechanism that enables the task to perform
> the check twice with two differnet parameters, e.g. I call Task X to
> check Numer 4 in the array, and after it finishes, I want it to
> notify me, and also I want teh task X to check the 18 Number.

You'll need a loop in the tasks; at the top, they wait on a rendezvous
to get the number to check. Then do the check, then loop back.

You have to make sure all the tasks can terminate nicely; sometimes
that requires a Quit rendezvous.

> for the decency, I M studying Ada, and it is part of my work, so please try
> to help me as much as U can without writing the answers to me, I think some
> guide lines will be helpful.

Hope this helps.

-- 
-- Stephe




  reply	other threads:[~2003-12-18  2:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-17 22:08 A common array Ratson Janiv
2003-12-18  2:25 ` Stephen Leake [this message]
2003-12-18  3:10   ` Wes Groleau
2003-12-19 15:13     ` Mr. J.
2003-12-20  3:23       ` Wes Groleau
2003-12-19 15:10 ` Ratson Janiv
2003-12-20  9:24 ` Ratson Janiv
2003-12-20 18:06   ` Robert I. Eachus
2003-12-20 18:56 ` @Fill(NOSPAM)YourBrain.com
replies disabled

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