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

Kaspar Schleiser notifications at github.com
Wed Apr 24 17:01:02 CEST 2019

kaspar030 commented on this pull request.

> +
+ * @defgroup    sys_barriers Memory Barriers
+ * @ingroup     sys
+ * @brief       Memory Barriers
+ *
+ * # FAQ
+ * ## What are Memory Barriers
+ * Memory barriers suppress specific kinds optimization performed by the
+ * compiler or (in case of out-of-order CPUs) CPUs, depending on the barrier.
+ * This will most likely result in slower program execution and, thus, is in
+ * general unwanted. However, under specific circumstances, optimization can
+ * prevent correct execution.
+ *
+ * ## Why can't I use `volatile` instead
+ * Memory accesses to `volatile` can be viewed as an alternative to

There's one important aspect of "volatile": the compiler is forced to use the best-fitting memory write instruction it has available. E.g., on 32bit ARM, writing to an ```uint16_t foo *volatile``` will generate a 16bit store instruction.

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/20190424/184a7af0/attachment.html>

More information about the notifications mailing list