comp.lang.ada
 help / color / mirror / Atom feed
* Multitasking
@ 2002-12-07 12:16 arvids lemchens
  2002-12-07 14:09 ` Multitasking SteveD
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: arvids lemchens @ 2002-12-07 12:16 UTC (permalink / raw)


Hi,

playing around with tasks, i have following:

-----
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Calendar; use Ada.Calendar;
with Ada.Long_Long_Integer_Text_IO; use Ada.Long_Long_Integer_Text_IO;

Procedure tt is

task type TC is
   entry S(D : Positive);
   entry T(U : Positive);
end TC;
task body TC is
begin
   loop
      select
         Accept S(D : In Positive) do
         delay Standard.duration(D);
	 Put("Task S finished at ");
	 Put(Long_Long_Integer(Seconds(Clock)));
	 New_Line;
         end S;
      or
         Accept T(U : In Positive) do
         delay Standard.duration(U);
	 Put("Task T finished at ");
	 Put(Long_Long_Integer(Seconds(Clock)));
	 New_Line;
         end T;
      or
         terminate;
      end select;
   end loop;
end TC;

type TCPtr is access TC;
type TList is array (Positive range <>) of TCPtr;
CList : TList(1..10000);

begin
   CList(1) := new TC;
   Put("Start Task S at: ");
   Put(Long_Long_Integer(Seconds(Clock)));
   New_Line;
   CList(1).S(60);
   Put("End Task S ");
   Put(Long_Long_Integer(Seconds(Clock)));
   New_Line;
   Put("Start Task U ");
   Put(Long_Long_Integer(Seconds(Clock)));
   New_Line;
   CList(1).S(120);
   Put("End Task U ");
   Put(Long_Long_Integer(Seconds(Clock)));
   New_Line;
end tt;
-----

Output is:
-----
Start Task S at:          46831
Task S finished at        46891
End Task S                46891
Start Task U              46891
Task S finished at        47011
End Task U                47011
-----

Now i am wondering why the maintask is waiting for the completion of
S and T and not going independent of them on?

Am i missing something fundamental about ada-tasks?

If yes, what and how do i get them running independent?

If it matters, i am using the linuxversion of gnat 3.14p.


MvfG,

Arvids







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

end of thread, other threads:[~2002-12-11 19:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-07 12:16 Multitasking arvids lemchens
2002-12-07 14:09 ` Multitasking SteveD
2002-12-09  7:43   ` Multitasking arvids lemchens
2002-12-07 14:10 ` Multitasking Michal Nowak
2002-12-09  9:57   ` Multitasking arvids lemchens
2002-12-09 22:27     ` Multitasking Michal Nowak
2002-12-07 21:33 ` Multitasking Dennis Lee Bieber
2002-12-08  0:17   ` Multitasking Dennis Lee Bieber
2002-12-09  9:54     ` Multitasking arvids lemchens
2002-12-09 20:48       ` Multitasking Dennis Lee Bieber
2002-12-11 12:45         ` Multitasking John English
2002-12-11 19:34           ` Multitasking Dennis Lee Bieber

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