comp.lang.ada
 help / color / mirror / Atom feed
From: "Gert Caspersen" <gec@cri.dk>
Subject: GNAT DOS Delay Problems
Date: 1997/09/26
Date: 1997-09-26T00:00:00+00:00	[thread overview]
Message-ID: <01bcca6e$e2e4f3c0$1601030a@lovina.cri.dk> (raw)



When running the below program, no context switch takes place. Task T1 with
the low priority is starved by task T2 with the high priority.

In my opinion, T1 should be scheduled when T2 executes delay 10.0. However,
this appears never to happen. Rather, the entire program is suspended for
ten seconds.

I am using GNAT version 3.07 for DOS.

Any ideas of the cause would be appreciated....

with Ada.Text_IO;
procedure Dims is

   task T1 is
      pragma Priority (2);
   end T1;

   task T2 is
      pragma Priority (3);
   end T2;

   task body T1 is
   begin  -- T1
      loop
         Ada.Text_IO.Put_Line("Task 1");
         delay (1.0);
      end loop;
   exception
      when others =>
         Ada.Text_IO.Put_Line("Task 1 got exception");
   end T1;

   task body T2 is
   begin  -- T2
      loop
         Ada.Text_IO.Put_Line("Task 2");
         delay (10.0);
      end loop;
   exception
      when others =>
         Ada.Text_IO.Put_Line("Task 2 got exception");
   end T2;

begin  -- Dims
   null;
end Dims;





             reply	other threads:[~1997-09-26  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-26  0:00 Gert Caspersen [this message]
1997-09-27  0:00 ` GNAT DOS Delay Problems juan carlos diaz martin
1997-09-29  0:00 ` Samuel T. Harris
replies disabled

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