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

Marian Buschsieweke notifications at github.com
Thu Mar 7 15:36:26 CET 2019

maribu requested changes on this pull request.

Indeed a nice addition. I would like to have the API clarified in case `irq_is_enabled()` is called from interrupt context to avoid confusion.

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

I think the API should clearly state what to expect if this function is called from interrupt context.

> @@ -53,6 +57,41 @@ int main(void)
+    /* check if we can control interrupt enabling properly */
+    /* initially, interrupts should be enabled */
+    if (!irq_is_enabled()) {
+        goto err;

I'd prefer something like

static inline int print_error(void)
    return 0;

and than replace `goto err;` by `return print_error();`. It would still be a one-line, but without the ["go to hell"-achievement](https://blog.gouline.net/achievement-unlocked-visual-studio-user-92ac27cfa6e4) unlocked

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190307/6f50978d/attachment.html>

More information about the notifications mailing list