comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Problem with tutorial example
Date: Mon, 22 Sep 2014 07:23:36 +0100
Date: 2014-09-22T07:23:36+01:00	[thread overview]
Message-ID: <lyha00golz.fsf@pushface.org> (raw)
In-Reply-To: 19829aef-4baa-4d96-a205-7e72b8a6d9a8@googlegroups.com

Stribor40 <ikamzic@gmail.com> writes:

> I am trying to study example i found in this page
> http://infres.enst.fr/~pautet/Ada95/e_c26_p2.ada where first, second
> and third tasks output lines of text to monitor but main task at the
> end of the program never calls any of these tasks.  Now i understand
> that Ada uses linear declaration and that it loads each tasks and
> makes each tasks wait at the "begin". So as lines are read each tasks
> execuatable part is loaded but each tasks wait at begin.
> Now main task doesnt call any of these other 3 tasks at all. All it
> does is output line of text "i am main..."
> Can someone point out how do these 3 tasks get fired up please?

None of the tasks have anything to stop them running as soon as they are
able to, so that's what they'll do. And the point at which they are able
to start running is at the end of the declarative region in which they
are declared .. which is the 'begin' of the main program.

You could give them something that needs to be called using an entry ..

   task First_Task is
      entry Start;
   end First_Task;
   task body First_Task is
   begin
      accept Start;
      for Index in 1..4 loop
         Put("This is in First_Task, pass number ");

and then something (the main program, probably) would have to call
First_Task.Start before First_Task could proceed.


      parent reply	other threads:[~2014-09-22  6:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-22  2:47 Problem with tutorial example Stribor40
2014-09-22  6:21 ` Jeffrey Carter
2014-09-22  6:23 ` Simon Wright [this message]
replies disabled

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