Warning, file /include/QtCore/qtsan_impl.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005 #ifndef QTSAN_IMPL_H
0006 #define QTSAN_IMPL_H
0007
0008 #include <QtCore/qglobal.h>
0009
0010 #if (__has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__)) && __has_include(<sanitizer/tsan_interface.h>)
0011 # define QT_BUILDING_UNDER_TSAN
0012 # include <sanitizer/tsan_interface.h>
0013 #endif
0014
0015 QT_BEGIN_NAMESPACE
0016
0017 namespace QtTsan {
0018 #ifdef QT_BUILDING_UNDER_TSAN
0019 inline void futexAcquire(void *addr, void *addr2 = nullptr)
0020 {
0021
0022
0023
0024 ::__tsan_acquire(addr);
0025 if (addr2)
0026 ::__tsan_acquire(addr2);
0027 }
0028
0029 inline void futexRelease(void *addr, void *addr2 = nullptr)
0030 {
0031 if (addr2)
0032 ::__tsan_release(addr2);
0033 ::__tsan_release(addr);
0034 }
0035
0036 inline void mutexPreLock(void *addr, unsigned flags)
0037 {
0038 ::__tsan_mutex_pre_lock(addr, flags);
0039 }
0040
0041 inline void mutexPostLock(void *addr, unsigned flags, int recursion)
0042 {
0043 ::__tsan_mutex_post_lock(addr, flags, recursion);
0044 }
0045
0046 inline void mutexPreUnlock(void *addr, unsigned flags)
0047 {
0048 ::__tsan_mutex_pre_unlock(addr, flags);
0049 }
0050
0051 inline void mutexPostUnlock(void *addr, unsigned flags)
0052 {
0053 ::__tsan_mutex_post_unlock(addr, flags);
0054 }
0055
0056 enum : unsigned {
0057 MutexWriteReentrant = ::__tsan_mutex_write_reentrant,
0058 TryLock = ::__tsan_mutex_try_lock,
0059 TryLockFailed = ::__tsan_mutex_try_lock_failed,
0060 };
0061 #else
0062 inline void futexAcquire(void *, void * = nullptr) {}
0063 inline void futexRelease(void *, void * = nullptr) {}
0064
0065 enum : unsigned {
0066 MutexWriteReentrant,
0067 TryLock,
0068 TryLockFailed,
0069 };
0070 inline void mutexPreLock(void *, unsigned) {}
0071 inline void mutexPostLock(void *, unsigned, int) {}
0072 inline void mutexPreUnlock(void *, unsigned) {}
0073 inline void mutexPostUnlock(void *, unsigned) {}
0074 #endif
0075 }
0076
0077 QT_END_NAMESPACE
0078
0079 #endif