comp.lang.ada
 help / color / mirror / Atom feed
* Specify priority of main program
@ 2021-01-23 17:55 Simon Wright
  2021-01-23 21:45 ` Simon Wright
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Wright @ 2021-01-23 17:55 UTC (permalink / raw)


GNAT allows you to specify the main program's priority (actually, I
suspect it'd allow it on any parameterless library-level procedure, but
only the one actually used as main will count);

   procedure Main with Priority => 6 is

This is handy for embedded code where you don't want to waste the
environment task's stack space but need to run that code at a
non-default priority.

However, I can't see this use in the ARM; is it an extension?

If it's not a GNAT extension, what would the ARG view be likely to be
for similar permission for Storage_Size (and Secondary_Stack_Size, but
that is definitely a GNAT extension)?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Specify priority of main program
  2021-01-23 17:55 Specify priority of main program Simon Wright
@ 2021-01-23 21:45 ` Simon Wright
  2021-01-27  2:52   ` Randy Brukardt
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Wright @ 2021-01-23 21:45 UTC (permalink / raw)


Simon Wright <simon@pushface.org> writes:

> GNAT allows you to specify the main program's priority (actually, I
> suspect it'd allow it on any parameterless library-level procedure, but
> only the one actually used as main will count);
>
>    procedure Main with Priority => 6 is
>
> This is handy for embedded code where you don't want to waste the
> environment task's stack space but need to run that code at a
> non-default priority.
>
> However, I can't see this use in the ARM; is it an extension?

Found it now: ARM D.1(18).

This isn't mentioned in Annex J, Language Defined Aspects: (46),

   "Priority of a task object or type, or priority of a protected object
   or type; the priority is not in the interrupt range. See D.1."

> If it's not a GNAT extension, what would the ARG view be likely to be
> for similar permission for Storage_Size (and Secondary_Stack_Size, but
> that is definitely a GNAT extension)?

But this still stands.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Specify priority of main program
  2021-01-23 21:45 ` Simon Wright
@ 2021-01-27  2:52   ` Randy Brukardt
  0 siblings, 0 replies; 3+ messages in thread
From: Randy Brukardt @ 2021-01-27  2:52 UTC (permalink / raw)


"Simon Wright" <simon@pushface.org> wrote in message 
news:lya6szl448.fsf@pushface.org...
> Simon Wright <simon@pushface.org> writes:
>
>> GNAT allows you to specify the main program's priority (actually, I
>> suspect it'd allow it on any parameterless library-level procedure, but
>> only the one actually used as main will count);
>>
>>    procedure Main with Priority => 6 is
>>
>> This is handy for embedded code where you don't want to waste the
>> environment task's stack space but need to run that code at a
>> non-default priority.
>>
>> However, I can't see this use in the ARM; is it an extension?
>
> Found it now: ARM D.1(18).

I believe that CPU also can be specified for a subprogram in this way.

> This isn't mentioned in Annex J, Language Defined Aspects: (46),
>
>   "Priority of a task object or type, or priority of a protected object
>   or type; the priority is not in the interrupt range. See D.1."

These were intended to be super-short descriptions of the aspect; this one 
seems too long already. They're not trying to describe how the aspect is 
specified, just what it is. And it *is* true, since a subprogram aspect 
Priority is setting the priority of the environment task object.

>> If it's not a GNAT extension, what would the ARG view be likely to be
>> for similar permission for Storage_Size (and Secondary_Stack_Size, but
>> that is definitely a GNAT extension)?
>
> But this still stands.

I don't think the definition of Storage_Size would work out-of-the-box for a 
subprogram, since there wouldn't be an obvious place for it to get 
evaluated. So there's more work here than just slapping "for a subprogram" 
on the header. (Priority has to be static for a subprogram, and there is an 
additional rule explaining where it applies.)

But I don't see any other reason that Storage_Size shouldn't be allowed for 
a main subprogram. Probably it would take someone asking... :-)

                                         Randy.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-27  2:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23 17:55 Specify priority of main program Simon Wright
2021-01-23 21:45 ` Simon Wright
2021-01-27  2:52   ` Randy Brukardt

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