From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a5d:8794:: with SMTP id f20mr2554817ion.32.1550839699599; Fri, 22 Feb 2019 04:48:19 -0800 (PST) X-Received: by 2002:a05:6830:16d4:: with SMTP id l20mr39439otr.0.1550839699014; Fri, 22 Feb 2019 04:48:19 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!y22no95023ita.0!news-out.google.com!d79ni170itc.0!nntp.google.com!y22no95021ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 22 Feb 2019 04:48:18 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a01:c50e:ac00:b900:11c1:abd1:8248:d5e7; posting-account=C8J7NQoAAAD_ybGY7--QIRi6KpLjoH1Z NNTP-Posting-Host: 2a01:c50e:ac00:b900:11c1:abd1:8248:d5e7 References: <87222ca9-1b35-467c-9560-f44bd59e3e55@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2db682dd-1db1-42b2-8f04-d9b42f40a549@googlegroups.com> Subject: Re: Simple 4 lines hang code using Ravenscar. Its this a Gnat bug? From: Daniel Injection-Date: Fri, 22 Feb 2019 12:48:19 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:55630 Date: 2019-02-22T04:48:18-08:00 List-Id: El viernes, 22 de febrero de 2019, 11:01:51 (UTC+1), Niklas Holsti escribi= =C3=B3: > On 19-02-22 10:56 , Daniel wrote: > > > > Hello, > > I found something strange using Ravenscar with Gnat. The code hangs wit= hout any explanation when i try to declare a task type...=C2=A1even if i do= nt 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. > > >=20 > In a Ravenscar program, no task should terminate, and this includes the= =20 > environment task. However, your "main" subprogram, which is where the=20 > environment task ends up after elaboration, does terminate. Therefore no= =20 > Ravenscar program is expected to terminate at all! >=20 > My guess is that without the task-type declaration, the tasking part of= =20 > the Ravenscar run-time is omitted from the program, and the environment= =20 > task can terminate and this terminates the program. With the task-type=20 > declaration, the Ravenscar tasking run-time is included, and termination= =20 > of the environment task becomes a no-no. Or at least it no longer=20 > terminates the program, which therefore seems to "hang". >=20 > This is just a guess, of course. >=20 > You could try to put an eternal loop in the "main", say >=20 > loop > Put_Line ("Idling..."); > delay until Ada.Real_Time.Clock + Ada.Real_Time.Seconds (1); > end loop; >=20 > HTH >=20 > --=20 > Niklas Holsti > Tidorum Ltd > niklas holsti tidorum fi > . @ . It really make sense. Thank you.