comp.lang.ada
 help / color / mirror / Atom feed
From: lemchens@lemmies.lb.bawue.de (arvids lemchens)
Subject: Multitasking
Date: 07 Dec 2002 13:16:00 +0100
Date: 2002-12-07T13:16:00+01:00	[thread overview]
Message-ID: <8bRwOT7FACB@lemmies.lb.bawue.de> (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







             reply	other threads:[~2002-12-07 12:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-07 12:16 arvids lemchens [this message]
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
replies disabled

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