* Simple 4 lines hang code using Ravenscar. Its this a Gnat bug? @ 2019-02-22 8:56 Daniel 2019-02-22 10:01 ` Niklas Holsti 2019-02-22 10:17 ` AdaMagica 0 siblings, 2 replies; 6+ messages in thread From: Daniel @ 2019-02-22 8:56 UTC (permalink / raw) 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Simple 4 lines hang code using Ravenscar. Its this a Gnat bug? 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 2019-02-22 10:17 ` AdaMagica 1 sibling, 1 reply; 6+ messages in thread From: Niklas Holsti @ 2019-02-22 10:01 UTC (permalink / raw) 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 . @ . ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Simple 4 lines hang code using Ravenscar. Its this a Gnat bug? 2019-02-22 10:01 ` Niklas Holsti @ 2019-02-22 12:48 ` Daniel 0 siblings, 0 replies; 6+ messages in thread From: Daniel @ 2019-02-22 12:48 UTC (permalink / raw) 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Simple 4 lines hang code using Ravenscar. Its this a Gnat bug? 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 10:17 ` AdaMagica 2019-02-22 12:55 ` Simon Wright 2019-02-22 12:55 ` Simon Wright 1 sibling, 2 replies; 6+ messages in thread From: AdaMagica @ 2019-02-22 10:17 UTC (permalink / raw) pragma Profile is a configuration pragma, and as such it must be defined (for Gnat) in a special configuration unit. Niklas has answered the prolem with Ravenscar. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Simple 4 lines hang code using Ravenscar. Its this a Gnat bug? 2019-02-22 10:17 ` AdaMagica @ 2019-02-22 12:55 ` Simon Wright 2019-02-22 12:55 ` Simon Wright 1 sibling, 0 replies; 6+ messages in thread From: Simon Wright @ 2019-02-22 12:55 UTC (permalink / raw) AdaMagica <christ-usch.grein@t-online.de> writes: > pragma Profile is a configuration pragma, and as such it must be > defined (for Gnat) in a special configuration unit. I'm not sure what the rules are, and it's certainly true that putting the configuration pragmas in a special unit (typically, and with gnatmake automatically effective if found, gnat.adc). But, if they're for use in a [GNAT?] configurable runtime, it's best to put them in system.ads so there's no chance of confusion when compiling against the runtime. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Simple 4 lines hang code using Ravenscar. Its this a Gnat bug? 2019-02-22 10:17 ` AdaMagica 2019-02-22 12:55 ` Simon Wright @ 2019-02-22 12:55 ` Simon Wright 1 sibling, 0 replies; 6+ messages in thread From: Simon Wright @ 2019-02-22 12:55 UTC (permalink / raw) AdaMagica <christ-usch.grein@t-online.de> writes: > pragma Profile is a configuration pragma, and as such it must be > defined (for Gnat) in a special configuration unit. I'm not sure what the rules are, and it's certainly true that putting the configuration pragmas in a special unit (typically, and with gnatmake automatically effective if found, gnat.adc). But, if they're for use in a [GNAT?] configurable runtime, it's best to put them in system.ads so there's no chance of confusion when compiling against the runtime. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-02-22 12:55 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 2019-02-22 10:17 ` AdaMagica 2019-02-22 12:55 ` Simon Wright 2019-02-22 12:55 ` Simon Wright
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox