[riot-notifications] [RIOT-OS/RIOT] sys: Added simple memory barrier API (#11438)

Marian Buschsieweke notifications at github.com
Thu Apr 25 13:11:55 CEST 2019


I guess it would be nice to have something like [`READ_ONCE(x)`](https://github.com/torvalds/linux/blob/cd8dead0c39457e58ec1d36db93aedca811d48f1/include/linux/compiler.h#L263) and [`WRITE_ONCE(x)`](https://github.com/torvalds/linux/blob/cd8dead0c39457e58ec1d36db93aedca811d48f1/include/linux/compiler.h#L278)  as well.

E.g. consider this code: https://github.com/RIOT-OS/RIOT/blob/215d5cdc1c7cb5c61fcdbda150e083759f655c50/cpu/atmega_common/irq_arch.c#L88-L91

I think it would need to be written something like this:

```C
int irq_is_in(void)
{
    int retval;
    retval = __in_isr;
    compiler_barrier();
    return retval;
}
```

-- 
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/11438#issuecomment-486629595
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190425/b1cdef52/attachment.html>


More information about the notifications mailing list