comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Protected Objects and Interrupt Handlers
Date: Sat, 27 Feb 2016 10:06:13 -0800 (PST)
Date: 2016-02-27T10:06:13-08:00	[thread overview]
Message-ID: <90861757-7eab-496c-8aeb-663e04c6085e@googlegroups.com> (raw)
In-Reply-To: <lywppslr0t.fsf@pushface.org>


> 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.

Good point, but this problem is not easy to avoid. Note that protected procedures cannot be called when any other task is inside the entry, so there will be some periods of time when calling the procedure will be prohibited no matter whether it is called from the handler or is itself a handler. How this is done is another story, but disabling interrupts altogether seems to be a very heavy-handed option. Note also that if the interrupt handler has something to do, moving as much of this work outside of the protected object (that is, *before* calling the protected procedure) reduces the amount of time the handler is inside the critical section, so I would still defend the idea of having the non-protected handler doing the data preparation and then calling the protected procedure just for the data exchange.

Interestingly, the C standard does not have any reasonable solution for this, except the explicit provision for communication via some dedicated atomic primitive type. I mention this not to criticize C, but to point out that in practice and depending on circumstances (ie. on the actual target), this might be the only valid solution in Ada, too.

-- 
Maciej Sobczak * http://www.inspirel.com

  parent reply	other threads:[~2016-02-27 18:06 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
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 [this message]
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