[riot-notifications] [RIOT-OS/RIOT] sys: Added simple memory barrier API (#11438)
notifications at github.com
Wed Apr 24 17:05:08 CEST 2019
maribu 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
What the Linux guys do is writing a helper function-like macro that casts the pointer to a pointer to `volatile` memory of the same type and performs the memory access. This will prevent optimization only for that very access that needs to be done in a properly sized store
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...
More information about the notifications