|
Last change
on this file since 9bfa8c8 was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago |
|
Replace some license headers with SPDX identifier
Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.
|
-
Property mode
set to
100644
|
|
File size:
767 bytes
|
| Rev | Line | |
|---|
| [11904316] | 1 | /*
|
|---|
| [d7f7a4a] | 2 | * SPDX-FileCopyrightText: 2012 Adam Hraska
|
|---|
| [11904316] | 3 | *
|
|---|
| [d7f7a4a] | 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| [11904316] | 5 | */
|
|---|
| 6 |
|
|---|
| 7 | /** @addtogroup libc
|
|---|
| 8 | * @{
|
|---|
| 9 | */
|
|---|
| 10 | /** @file
|
|---|
| 11 | */
|
|---|
| 12 |
|
|---|
| [4805495] | 13 | #ifndef _LIBC_COMPILER_BARRIER_H_
|
|---|
| 14 | #define _LIBC_COMPILER_BARRIER_H_
|
|---|
| [11904316] | 15 |
|
|---|
| [d51cca8] | 16 | #include <stdatomic.h>
|
|---|
| [05882233] | 17 |
|
|---|
| [d51cca8] | 18 | static inline void compiler_barrier(void)
|
|---|
| 19 | {
|
|---|
| 20 | atomic_signal_fence(memory_order_seq_cst);
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | static inline void memory_barrier(void)
|
|---|
| 24 | {
|
|---|
| 25 | atomic_thread_fence(memory_order_seq_cst);
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | static inline void read_barrier(void)
|
|---|
| 29 | {
|
|---|
| 30 | atomic_thread_fence(memory_order_acquire);
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | static inline void write_barrier(void)
|
|---|
| 34 | {
|
|---|
| 35 | atomic_thread_fence(memory_order_release);
|
|---|
| 36 | }
|
|---|
| [11904316] | 37 |
|
|---|
| 38 | /** Forces the compiler to access (ie load/store) the variable only once. */
|
|---|
| 39 | #define ACCESS_ONCE(var) (*((volatile typeof(var)*)&(var)))
|
|---|
| 40 |
|
|---|
| [4805495] | 41 | #endif /* _LIBC_COMPILER_BARRIER_H_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.