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!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Protected Objects and Interrupt Handlers Date: Fri, 26 Feb 2016 08:12:58 +0000 Organization: A noiseless patient Spider Message-ID: References: <7663896a-a15e-47fd-8c7e-54a1c20d8d0f@googlegroups.com> <2922ffdd-9678-4502-9bcb-8b199af91543@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="03d977edd803a9f1bf346d48fa393156"; logging-data="29223"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18O1kD3RprqKzY+DQdGT42BLdUtPRACfrA=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:Oh5b2rmx0dQYYUIVoGCUrme+emA= sha1:kE0K/X7iRghOOEtyHIge01MsUEA= Xref: news.eternal-september.org comp.lang.ada:29614 Date: 2016-02-26T08:12:58+00:00 List-Id: Dennis Lee Bieber writes: > On Thu, 25 Feb 2016 15:59:46 +0000, Simon Wright > declaimed the following: > >>Maciej Sobczak writes: >> >>> Note also that it is easy to combine these two approaches - just let >>> the interrupt handler (a procedure) interact with a dedicated >>> protected object (by forwarding to its procedures) as if it was a >>> regular work-item producing task - which, conceptually, it really is. >> >>I think this approach might have problems; if the PO doesn't expect to >>be called in an interrupt context, it may do things (like block) which >>an ISR should never do. >> > As I recall, Ada protected objects are not supposed to contain anything > that could block. > > http://www.iuma.ulpgc.es/users/jmiranda/gnat-rts/node25.htm#SECTION00814000000000000000 That's for code _inside_ the PO. As the document you reference says, In general, code executed inside a protected object should be as brief as possible. This is because whilst the code is being executed other tasks are delayed when they try to gain access to the protected object. and you wouldn't want an ISR to be "delayed when [it tries] to gain access to the protected object".