Files
mxtasking/src/mx/util/maybe_atomic.h
2024-07-23 16:27:49 +02:00

15 lines
390 B
C++

#pragma once
#include <atomic>
namespace mx::util {
/**
* The maybe_atomic<T> makes T atomic in ARM hardware but none-atomic on x86_64.
*/
#if defined(__x86_64__) && (!defined(__has_feature)) //|| !__has_feature(thread_sanitizer))
template <typename T> using maybe_atomic = std::atomic<T>;
#else
template <typename T> using maybe_atomic = std::atomic<T>;
#endif
} // namespace mx::util