comp.lang.ada
 help / color / mirror / Atom feed
From: Sebastien Pochic <spochic@INnet.be>
Subject: Tasking newbee
Date: 1997/04/01
Date: 1997-04-01T00:00:00+00:00	[thread overview]
Message-ID: <33412898.2A8C@INnet.be> (raw)


hi,

 could someone explain what I should do so that the small tasks (without
the loop) will end before the "big" task (with the loop), in my example
it first counts the loop before even beginning the other tasks..
here's my example:

with Ada.Text_IO; use Ada.Text_IO;



procedure Tasking is

  task First_Task is

    entry Hello;

    entry Hi;

  end First_Task;



  task body First_Task is

  begin

    loop

      select

        accept Hello do

          for i in 1..1000000 loop

            null;

          end loop;

          put("Hello! I'm task #1");

          new_line;

        end Hello;

      or

        accept Hi do

          put("Hi, I'm task #1");

          new_line;

        end Hi;

      end select;

    end loop;

  end First_Task;



  task Second_Task is

    entry Hello;

    entry Hi;

  end Second_Task;



  task body Second_Task is

  begin

    loop

      select

        accept Hello do

          put("Hello! I'm task #2");

          new_line;

        end Hello;

      or

        accept Hi do

          put("Hi, I'm task #2");

          new_line;

        end Hi;

      end select;

    end loop;

  end Second_Task;



begin

  First_Task.Hello;

  First_Task.Hi;

  Second_Task.Hello;

  Second_Task.Hi;

end Tasking;


thanks,

-- sebastien


                 \/||/
                 (o o)
-------------oOO--(_)--OOo-------------
Sebastien POCHIC
Computer Science (FSA) - ULB - Brussels
mailto:spochic@INnet.be
----------------------Oooo-------------
              oooO    (   ) 
              (   )    ) /  
               \ (    (_/
                \_)




             reply	other threads:[~1997-04-01  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-01  0:00 Sebastien Pochic [this message]
1997-04-01  0:00 ` Tasking newbee Richard Toy
1997-04-01  0:00 ` john schneider
1997-04-05  0:00 ` elaine.waybright
replies disabled

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