Hacker News new | ask | show | jobs
by david-given 3874 days ago
In Ada you just annotate a procedure as being an interrupt handler and it Just Works.

In addition, you can annotate a protected object (essentially, a group of shared procedures protected by an implicit mutex) as being interrupt-safe, and then any access to that object will be automatically protected by the appropriate instructions.

Plus, if you're in a Posix environment, you can use the exact same mechanism for interrupt handling. It's all remarkably elegant.

Alas, like everything Ada, the documentation is opaque in the extreme, but:

https://www2.adacore.com/gap-static/GNAT_Book/html/aarm/AA-C...

Note that at the bottom they're defining a parameterised interrupt handler structure and then instantiating it multiple times on multiple IRQs, each of which is in its own isolation domain...