comp.lang.ada
 help / color / mirror / Atom feed
* How D.15 "Timing Events" are implemented? (SIGALRM)
@ 2017-11-16  2:51 Victor Porton
  2017-11-16 16:22 ` Simon Wright
  0 siblings, 1 reply; 2+ messages in thread
From: Victor Porton @ 2017-11-16  2:51 UTC (permalink / raw)


Signal handlers (including SIGALRM) on Unix must not call non-reentrant 
functions.

So how D.15 Timing Events works in Ada? (I am interested mostly in GNAT 
implementation.)

Because Ada RM does not require the handler to be "reentrant", this cannot 
be implemented straight as a SIGALRM handler. What is the implementation?

-- 
Victor Porton - http://portonvictor.org

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

* Re: How D.15 "Timing Events" are implemented? (SIGALRM)
  2017-11-16  2:51 How D.15 "Timing Events" are implemented? (SIGALRM) Victor Porton
@ 2017-11-16 16:22 ` Simon Wright
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Wright @ 2017-11-16 16:22 UTC (permalink / raw)


Victor Porton <porton@narod.ru> writes:

> Signal handlers (including SIGALRM) on Unix must not call non-reentrant 
> functions.
>
> So how D.15 Timing Events works in Ada? (I am interested mostly in GNAT 
> implementation.)

You can look at the implementation just as well as I can.

The plain GCC source runs a highest-priority task, which as implemented
loops over the queued events every 100 ms.

My Cortex GNAT RTS version[1] does the same but every 10 ms (plus a
what was meant to be a slight optimisation if there is a next event, but
which I see now I look at it is wrong if the next event is more than 10
ms away).

AdaCore's bare-board implementations run timing events off timer
interrupts (note, *not* SIGALRMs).

[1] https://github.com/simonjwright/cortex-gnat-rts/blob/master/common/a-rttiev.adb

> Because Ada RM does not require the handler to be "reentrant", this
> cannot be implemented straight as a SIGALRM handler. What is the
> implementation?

If this were relevant, I'd say that the ARM may not require the handler
to be reentrant, but people who buy (or use!) Ada compilers expect them
to work, so the implementers have to deal with "problems" like this all
the time.

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

end of thread, other threads:[~2017-11-16 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-16  2:51 How D.15 "Timing Events" are implemented? (SIGALRM) Victor Porton
2017-11-16 16:22 ` Simon Wright

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