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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.129.102.215 with SMTP id a206mr39823292ywc.40.1456349838661; Wed, 24 Feb 2016 13:37:18 -0800 (PST) X-Received: by 10.182.113.198 with SMTP id ja6mr503354obb.0.1456349838563; Wed, 24 Feb 2016 13:37:18 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!w104no3307857qge.1!news-out.google.com!h70ni554qge.0!nntp.google.com!hb3no8721276igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 24 Feb 2016 13:37:18 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=138.162.0.41; posting-account=9yqilwkAAAAlbxojEc6DW1OEOsACipCN NNTP-Posting-Host: 138.162.0.41 References: <7663896a-a15e-47fd-8c7e-54a1c20d8d0f@googlegroups.com> <85b5c378-dbaf-459b-afcd-dc5ed7692ee9@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Protected Objects and Interrupt Handlers From: Jere Injection-Date: Wed, 24 Feb 2016 21:37:18 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:29600 Date: 2016-02-24T13:37:18-08:00 List-Id: On Wednesday, February 24, 2016 at 1:29:24 PM UTC-5, Simon Wright wrote: > GNAT (don't forget there are other Ada compilers!) handles differences > between tasks & interrupts calling protected procedures very similarly; > the difference is, I believe, in the way locks are handled. > > I don't know too much about the way AdaCore's bare board implementation > does this; the way I dealt with this at [1] was to implement > System.Tasking.Protected_Objects.Lock and .Lock_Read_Only as > > if in an ISR then > null; > elsif this PO's ceiling priority is an interrupt priority then > -- we are in a task, but this PO deals with interrupts, so we > -- mustn't be interrupted > disable interrupts; > else > -- we are in a task and this PO doesn't deal with interrupts > take the PO's mutex; > raise the priority to the PO's ceiling > end if; > > [1] https://sourceforge.net/projects/cortex-gnat-rts/ Ok, that makes more sense then. Thank you!