static int runOnTsan;
static int hasReductionCallback;
+namespace {
class ArcherFlags {
public:
#if (LLVM_VERSION) >= 40
}
}
};
+} // namespace
#if (LLVM_VERSION) >= 40
extern "C" {
void __attribute__((weak)) __tsan_flush_memory() {}
}
#endif
-ArcherFlags *archer_flags;
+static ArcherFlags *archer_flags;
#ifndef TsanHappensBefore
// Thread Sanitizer is a tool that finds races in code.
// Data structure to provide a threadsafe pool of reusable objects.
// DataPool<Type of objects>
+namespace {
template <typename T> struct DataPool final {
static __thread DataPool<T> *ThreadDataPool;
std::mutex DPMutex{};
TaskData(DataPool<TaskData> *dp) : DataPoolEntry<TaskData>(dp) {}
};
+} // namespace
static inline TaskData *ToTaskData(ompt_data_t *task_data) {
return reinterpret_cast<TaskData *>(task_data->ptr);
}
/// Store a mutex for each wait_id to resolve race condition with callbacks.
-std::unordered_map<ompt_wait_id_t, std::mutex> Locks;
-std::mutex LocksMutex;
+static std::unordered_map<ompt_wait_id_t, std::mutex> Locks;
+static std::mutex LocksMutex;
static void ompt_tsan_thread_begin(ompt_thread_t thread_type,
ompt_data_t *thread_data) {