comp.lang.ada
 help / color / mirror / Atom feed
* Tasking newbee
@ 1997-04-01  0:00 Sebastien Pochic
  1997-04-01  0:00 ` john schneider
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sebastien Pochic @ 1997-04-01  0:00 UTC (permalink / 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    (   ) 
              (   )    ) /  
               \ (    (_/
                \_)




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

end of thread, other threads:[~1997-04-05  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-01  0:00 Tasking newbee Sebastien Pochic
1997-04-01  0:00 ` john schneider
1997-04-01  0:00 ` Richard Toy
1997-04-05  0:00 ` elaine.waybright

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