From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: process blocking
Date: Thu, 09 Sep 2004 20:09:12 +0200
Date: 2004-09-09T20:11:08+02:00 [thread overview]
Message-ID: <873c1rtiuv.fsf@insalien.org> (raw)
In-Reply-To: 41404385$1@dnews.tpgi.com.au
"P Hull" writes:
> Oh i was not looking for a static solution. pMain is visible to all
> tasks p1..pn. The first task (i.e. one of p1..pn based upon some
> timing mechanism) will rendezvous with pMain and seizes pMain. And
> once pi has finished whatever it wants to do with pMain, some other
> task within p1..pn will then next rendezvous with pMain and seize
> it, and once finished .. etc etc
>
> I know this should be simple to implement. Thanks for any help
Why does pMain have to be a task? Could it not be a protected object
instead? Then, the task pi would call a procedure or entry in the
protected object. While that procedure or entry is executing, other
tasks that also want to execute a procedure or entry in pMain must
wait.
Here is an example:
protected pMain is
procedure Seize_And_Do_Whatever;
private
Protected_Data : Integer;
end pMain;
protected body pMain is
procedure Seize_And_Do_Whatever is
begin
Protected_Data := 42;
end Seize_And_Do_Whatever;
end pMain;
Now, any task pi can call pMain.Seize_And_Do_Whatever. The processing
takes place in the task pi; pi is not blocked. If another task, pj,
wants to call pMain.Seize_And_Do_Whatever, it waits.
See the reference manual section 9.4 for more details.
[1] http://www.adaic.org/standards/ada95.html
[2] http://www.adaic.org/standards/95lrm/html/RM-9-4.html
--
Ludovic Brenta.
next prev parent reply other threads:[~2004-09-09 18:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-09 7:49 process blocking P Hull
2004-09-09 11:38 ` Stephen Leake
2004-09-09 11:50 ` P Hull
2004-09-09 14:51 ` Georg Bauhaus
2004-09-09 18:09 ` Ludovic Brenta [this message]
2004-09-10 3:07 ` Steve
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox