blob: 33da511a385a890f23c9b7c077151d0926ff8591 [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001#ifndef AOS_UTIL_COMPILER_MEMORY_BARRIER_H_
2#define AOS_UTIL_COMPILER_MEMORY_BARRIER_H_
Brian Silverman3d37a5f2014-09-05 18:42:20 -04003
4// Prevents the compiler from reordering memory operations around this.
5// Using this function makes it clearer what you're doing and easier to be
6// portable.
7static inline void aos_compiler_memory_barrier(void) {
8 __asm__ __volatile__("" ::: "memory");
9}
10
John Park33858a32018-09-28 23:05:48 -070011#endif // AOS_UTIL_COMPILER_MEMORY_BARRIER_H_