[riot-notifications] [RIOT-OS/RIOT] core: add irq_is_enabled() function to irq interface (#11117)

Marian Buschsieweke notifications at github.com
Fri Mar 8 19:03:51 CET 2019


maribu commented on this pull request.



> @@ -60,6 +61,14 @@ unsigned irq_enable(void);
  */
 void irq_restore(unsigned state);
 
+/**
+ * @brief   Test if IRQs are currently enabled
+ *
+ * @return  0 (false) if IRQs are currently disabled
+ * @return  != 0 (true) if IRQs are currently enabled

Some would argue in ISR no other interrupts will interrupt the ISR and always return `0`, even when interrupts are not blocked by anything else then the fact an ISR is currently handeled. Others would disagree on that. When people would rely on either behaviour, bad things happen when the actual behaviour doesn't match the expectation. Also, maybe on some hardware it might be impossible to get the result from ISR context.

Stating explicitly that the return value is undefined when called from interrupt context might be the safest thing to do here.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11117#discussion_r263872339
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190308/ec4b00dd/attachment.html>


More information about the notifications mailing list