From: Simon Wright <simon@pushface.org>
Subject: Re: Protected Objects and Interrupt Handlers
Date: Wed, 24 Feb 2016 18:29:23 +0000
Date: 2016-02-24T18:29:23+00:00 [thread overview]
Message-ID: <ly60xem070.fsf@pushface.org> (raw)
In-Reply-To: 85b5c378-dbaf-459b-afcd-dc5ed7692ee9@googlegroups.com
Jere <jere.groups@gmail.com> writes:
> I would expect a protected entry or procedure to employ a different
> type of synchronization construct (maybe similar to a
> mutex/semiphore/etc.??) to keep multiple tasks from changing the data
> in the protected object at the same time than is needed for
> interrupts. For interrupts I would expect something more like
> disabling interrupts to be appropriate. Does a protected
> object/procedure behave differently for interrupts than it does for
> tasks under the hood and Ada is able to handle all those details based
> on the existence of the pragma used?
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/
next prev parent reply other threads:[~2016-02-24 18:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 22:25 Protected Objects and Interrupt Handlers Jere
2016-02-23 23:09 ` Simon Wright
2016-02-24 14:38 ` Jere
2016-02-24 18:29 ` Simon Wright [this message]
2016-02-24 21:37 ` Jere
2016-02-25 15:14 ` Maciej Sobczak
2016-02-25 15:59 ` Simon Wright
2016-02-26 3:20 ` Dennis Lee Bieber
2016-02-26 8:12 ` Simon Wright
2016-02-27 18:06 ` Maciej Sobczak
2016-02-25 16:02 ` Simon Wright
2016-02-25 17:40 ` Tero Koskinen
2016-02-25 19:49 ` Simon Wright
2016-03-13 8:10 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox