comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: task activation
Date: 1999/11/22
Date: 1999-11-22T00:00:00+00:00	[thread overview]
Message-ID: <wccg0xyxw9v.fsf@world.std.com> (raw)
In-Reply-To: 383733d3_1@news1.prserv.net

"Matthew Heaney" <matthew_heaney@acm.org> writes:

> It is my understanding that a task "activates" when you hit the begin 
> part of the block in which the task is declared:
> 
> procedure Main is
>   task O is ...
>   task body O is ...;
> begin
>   <whatever>
> end Main;
> 
> In this example, task O activates when procedure Main reaches its begin.
> 
> Now, suppose we wanted to activate the task earlier than that.  Let's
> declare O in a nested package:
> 
> procedure Main is
>   package P is
>     task O is ...;
>   end;
>   package body P is
>     task body O is ...;
>   end;
> begin
>   <whatever>
> end;
> 
> 
> Does task O activate when
> 
> 1) the elaboration of nested package P completes (hit the begin part of
> P's body); that is, prior to hitting the begin part of Main.  Or,
> 
> 2) no, the nesting doesn't matter, and O still activates when you hit
> the begin part of procedure Main.

Number 1.

> Another question: suppose package P is a library level package (and
> therefore task O is a library level task).  Does O get activated when
> 
> 1) you hit the begin part of P's body; that is, prior to hitting the
> begin part of Ada main subprogram Main?  Or,
> 
> 2) no, the library-levelness doesn't matter, and O still is activated
> when you hit the begin part of the Ada main.

Number 1 again.  If you have a bunch of such packages, they will get
elaborated in some order that depends on with clauses and various
pragmas -- but when you elaborate the package body, the tasks therein
will be activated.

Another way to control the timing of activation is to put the task in
the heap -- then, an allocator causes the activation, and you can put
that allocator whereever you like.

- Bob




  parent reply	other threads:[~1999-11-22  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-20  0:00 task activation Matthew Heaney
1999-11-21  0:00 ` Jean-Pierre Rosen
1999-11-22  0:00 ` Robert A Duff [this message]
1999-11-22  0:00   ` Matthew Heaney
1999-11-23  0:00     ` Mats Weber
1999-11-23  0:00       ` Matthew Heaney
1999-12-02  0:00   ` Ehud Lamm
1999-12-03  0:00     ` Simon Wright
1999-12-06  0:00       ` Robert Dewar
1999-12-06  0:00         ` Simon Wright
1999-12-06  0:00         ` Robert A Duff
1999-12-06  0:00       ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
2011-12-21 11:58 Task activation tonyg
2011-12-21 12:27 ` tonyg
2011-12-21 12:31   ` AdaMagica
2011-12-21 12:35 ` Niklas Holsti
2011-12-22  8:26   ` tonyg
replies disabled

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