From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Ada.Real_Time.Time_Last
Date: Fri, 17 Nov 2017 23:39:47 +0200
Date: 2017-11-17T23:39:47+02:00 [thread overview]
Message-ID: <f79394Ffvq2U1@mid.individual.net> (raw)
In-Reply-To: <ly8tf5dzy7.fsf@pushface.org>
On 17-11-17 11:20 , Simon Wright wrote:
> Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
>
>> On 17-11-15 16:28 , Simon Wright wrote:
>>> The only use case I can see for this is to allow us to write
>>>
>>> delay until Ada.Real_Time.Time_Last;
>>>
>>> at the end of our (Ravenscar) main program.
[snip]
>> (By the way, my Ravenscar programs always end in an eternal loop,
>> never in a delay until Time_Last.)
>
> Like
>
> loop
> null;
> end loop;
>
> ?
No, the environment task becomes one of the working application tasks
(why waste its stack space?), so more like
loop
Wait_For_Trigger_Or_Time;
Do_Something_Useful;
end loop;
> I'd have thought this would prevent the RTS from putting the processor
> to sleep, thus wasting energy.
In the only project I've done where the customer asked for sleep mode,
and we implemented it (that was in C, not Ada) the customer found,
during their system tests, that periodically entering and leaving sleep
mode caused supply-voltage transients that coupled into the analog parts
of the board and perturbed the instrument's ADC. So the SW was changed
to use an idle loop instead of sleeping. YMMV.
>> (By the further way, it is a pity that Ada does not let Ada.Real_Time
>> provide the attribute functions Time'Min and Time'Max.)
>
> I suppose there'd have to be a way of indicating that a private type was
> scalar.
Long ago, I suggested (on c.l.a) an Ada extension by which a package
could declare private types using the same classes of types that can be
used for generic formal types. That would IMO not only be useful for
programmers, it could formalise some of the informal text in the Ada RM.
For example, RM A.4.8 defines the type Ada.Direct_IO.Count as
type Count is range 0 .. implementation defined;
With the suggested extension, this could be written in legal (extended)
Ada as
type Count is private range <>;
That form still does not show that Count'First = 0, but with a little
further extension one could perhaps leave only the upper bound
unspecified, as in:
type Count is private range 0 .. <>;
Perhaps it is time for me to revive this proposal...
However, in the case of Ada.Real_Time.Time, it may be too much to
require that this type should be a scalar one, as it may need a
combination of range and precision that exceeds that of the largest
machine scalar.
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
next prev parent reply other threads:[~2017-11-17 21:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-15 14:28 Ada.Real_Time.Time_Last Simon Wright
2017-11-15 20:03 ` Ada.Real_Time.Time_Last Niklas Holsti
2017-11-17 9:20 ` Ada.Real_Time.Time_Last Simon Wright
2017-11-17 21:39 ` Niklas Holsti [this message]
2017-11-18 13:06 ` Ada.Real_Time.Time_Last AdaMagica
2017-11-18 13:18 ` Ada.Real_Time.Time_Last Niklas Holsti
2017-11-18 14:00 ` Ada.Real_Time.Time_Last AdaMagica
2017-11-18 14:15 ` Ada.Real_Time.Time_Last Jeffrey R. Carter
2017-11-18 15:24 ` Ada.Real_Time.Time_Last Niklas Holsti
2017-11-18 16:01 ` Ada.Real_Time.Time_Last Dmitry A. Kazakov
2017-11-18 17:31 ` Ada.Real_Time.Time_Last Niklas Holsti
2017-11-18 22:20 ` Ada.Real_Time.Time_Last Robert A Duff
2017-11-19 10:50 ` Ada.Real_Time.Time_Last Niklas Holsti
2017-11-20 5:57 ` Ada.Real_Time.Time_Last J-P. Rosen
2019-01-29 22:03 ` Ada.Real_Time.Time_Last 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