summaryrefslogtreecommitdiff
path: root/lib/ft8var/ft8_tsan.c
blob: 1905ca07103a9d7e3ca7825758e1e9aeb0858490 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#if defined(__SANITIZE_THREAD__)
#include <sanitizer/tsan_interface.h>
#endif

// GCC TSan does not observe libgomp synchronization. Stable tokens mirror the
// OpenMP edges without changing production synchronization.
#if defined(__SANITIZE_THREAD__)
#define WSJT_TSAN_SYNC(name)                            \
  static unsigned char name##_token;                    \
  void wsjt_tsan_acquire_##name(void)                    \
  {                                                      \
    __tsan_acquire(&name##_token);                       \
  }                                                      \
  void wsjt_tsan_release_##name(void)                    \
  {                                                      \
    __tsan_release(&name##_token);                       \
  }
#else
#define WSJT_TSAN_SYNC(name)                            \
  void wsjt_tsan_acquire_##name(void) {}                 \
  void wsjt_tsan_release_##name(void) {}
#endif

WSJT_TSAN_SYNC(ft8_mtd)
WSJT_TSAN_SYNC(four2avar_setup)
WSJT_TSAN_SYNC(ft8_find_dupes)
WSJT_TSAN_SYNC(ft8_update_structures)
WSJT_TSAN_SYNC(decoder_section_primary)
WSJT_TSAN_SYNC(decoder_section_secondary)
WSJT_TSAN_SYNC(msk40_sync)