From: Daniel <danielnorberto@gmail.com>
Subject: Re: Simple 4 lines hang code using Ravenscar. Its this a Gnat bug?
Date: Fri, 22 Feb 2019 04:48:18 -0800 (PST)
Date: 2019-02-22T04:48:18-08:00 [thread overview]
Message-ID: <2db682dd-1db1-42b2-8f04-d9b42f40a549@googlegroups.com> (raw)
In-Reply-To: <gd9vkdFt12gU1@mid.individual.net>
El viernes, 22 de febrero de 2019, 11:01:51 (UTC+1), Niklas Holsti escribió:
> On 19-02-22 10:56 , Daniel wrote:
> >
> > Hello,
> > I found something strange using Ravenscar with Gnat. The code hangs without any explanation when i try to declare a task type...¡even if i dont use any variable of this type!!. If i quit the Ravenscar pragma it works well. This is the code:
> >
> > --MAIN PROCEDURE
> > with tmr;
> > with ada.Text_IO; use ada.Text_IO;
> > procedure main is
> > begin
> > put_line("Let's hang..");
> > end main;
> >
> > --- TMR.ADS FILE
> > pragma Profile (Ravenscar);
> > package Tmr is
> > task type K_Timer is
> > end K_Timer;
> > end Tmr;
> >
> > -- TMR.ADB FILE
> > package body Tmr is
> > task body K_Timer is
> > begin
> > null;
> > end K_Timer;
> > end Tmr;
> >
> >
> > Im using GNAT GPL 2017 for windows.
> > Thank you and best regards.
> >
>
> In a Ravenscar program, no task should terminate, and this includes the
> environment task. However, your "main" subprogram, which is where the
> environment task ends up after elaboration, does terminate. Therefore no
> Ravenscar program is expected to terminate at all!
>
> My guess is that without the task-type declaration, the tasking part of
> the Ravenscar run-time is omitted from the program, and the environment
> task can terminate and this terminates the program. With the task-type
> declaration, the Ravenscar tasking run-time is included, and termination
> of the environment task becomes a no-no. Or at least it no longer
> terminates the program, which therefore seems to "hang".
>
> This is just a guess, of course.
>
> You could try to put an eternal loop in the "main", say
>
> loop
> Put_Line ("Idling...");
> delay until Ada.Real_Time.Clock + Ada.Real_Time.Seconds (1);
> end loop;
>
> HTH
>
> --
> Niklas Holsti
> Tidorum Ltd
> niklas holsti tidorum fi
> . @ .
It really make sense. Thank you.
next prev parent reply other threads:[~2019-02-22 12:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-22 8:56 Simple 4 lines hang code using Ravenscar. Its this a Gnat bug? Daniel
2019-02-22 10:01 ` Niklas Holsti
2019-02-22 12:48 ` Daniel [this message]
2019-02-22 10:17 ` AdaMagica
2019-02-22 12:55 ` Simon Wright
2019-02-22 12:55 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox