comp.lang.ada
 help / color / mirror / Atom feed
* Problem with tutorial example
@ 2014-09-22  2:47 Stribor40
  2014-09-22  6:21 ` Jeffrey Carter
  2014-09-22  6:23 ` Simon Wright
  0 siblings, 2 replies; 3+ messages in thread
From: Stribor40 @ 2014-09-22  2:47 UTC (permalink / raw)


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?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem with tutorial example
  2014-09-22  2:47 Problem with tutorial example Stribor40
@ 2014-09-22  6:21 ` Jeffrey Carter
  2014-09-22  6:23 ` Simon Wright
  1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey Carter @ 2014-09-22  6:21 UTC (permalink / raw)


On 09/21/2014 07:47 PM, Stribor40 wrote:
> 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?

Ada tasks don't get "fired up" by some external agent. They begin executing when
it is time for them to do so. For task objects in a declarative part, that is
when the declarative part has been elaborated..

-- 
Jeff Carter
"How'd you like to hide the egg and gurgitate
a few saucers of mocha java?"
Never Give a Sucker an Even Break
101


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem with tutorial example
  2014-09-22  2:47 Problem with tutorial example Stribor40
  2014-09-22  6:21 ` Jeffrey Carter
@ 2014-09-22  6:23 ` Simon Wright
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Wright @ 2014-09-22  6:23 UTC (permalink / raw)


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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-22  6:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox