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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: How D.15 "Timing Events" are implemented? (SIGALRM) Date: Thu, 16 Nov 2017 16:22:55 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="4a40b7fae8b5c6e88c4b9a9a737094bf"; logging-data="1426"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pNTxfVBlsRMNShMNxuSTw/B/2xDRmekY=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:/7q0L7S4OGQ8wZfITu4XI+AGqss= sha1:XsSkfxaV+V5ORpHnd4z4/l/4jP0= Xref: feeder.eternal-september.org comp.lang.ada:48934 Date: 2017-11-16T16:22:55+00:00 List-Id: Victor Porton 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.