ion
0.12.0
Atomic concurrency support library
Loading...
Searching...
No Matches
macros.hpp
1
/**
2
* @file
3
* @copyright
4
* SPDX-FileCopyrightText: 2022-2024 European Southern Observatory (ESO)
5
6
* SPDX-License-Identifier: LGPL-3.0-only
7
*/
8
#ifndef ION_DETAIL_MACROS_HPP
9
#define ION_DETAIL_MACROS_HPP
10
11
#include <new>
12
13
#if defined(__GNUG__)
14
#include <immintrin.h>
// _mm_pause
15
#define ION_FORCE_INLINE __attribute__((always_inline))
16
#define ION_PAUSE(x) _mm_pause()
17
#define ION_LIKELY(x) __builtin_expect(!!(x), 1)
18
#define ION_UNLIKELY(x) __builtin_expect(!!(x), 0)
19
#else
20
#define ION_FORCE_INLINE
21
#define ION_PAUSE(x)
22
#define ION_LIKELY(x)
23
#define ION_UNLIKELY(x)
24
#endif
25
26
#if defined(__SANITIZE_THREAD__)
27
// tsan does not support memory fences so ion manually annotate those acquire/releases
28
#include <sanitizer/tsan_interface.h>
29
#define ION_ANNOTATE_ACQUIRE(x) __tsan_acquire(x)
30
#define ION_ANNOTATE_RELEASE(x) __tsan_release(x)
31
#else
32
#define ION_ANNOTATE_ACQUIRE(x)
33
#define ION_ANNOTATE_RELEASE(x)
34
#endif
35
36
#ifdef __cpp_lib_hardware_interference_size
37
#define ION_DESTRUCTIVE_INTERFERENCE_SIZE std::hardware_destructive_interference_size
38
#else
39
#define ION_DESTRUCTIVE_INTERFERENCE_SIZE 64
40
#endif
41
42
#endif
// ION_DETAIL_MACROS_HPP
ion
src
include
ion
detail
macros.hpp
Generated by
1.13.2