2023-12-17 15:39:29 +01:00
2023-12-14 21:54:22 +01:00
/* safe_refcount.cpp */
2023-12-17 15:39:29 +01:00
2023-12-14 21:54:22 +01:00
# if defined(DEBUG_ENABLED) && !defined(NO_THREADS)
# include "safe_refcount.h"
# include "core/error/error_macros.h"
// On C++14 we don't have std::atomic::is_always_lockfree, so this is the best we can do
void check_lockless_atomics ( ) {
// Doing the check for the types we actually care about
if ( ! std : : atomic < uint32_t > { } . is_lock_free ( ) | | ! std : : atomic < uint64_t > { } . is_lock_free ( ) | | ! std : : atomic_bool { } . is_lock_free ( ) ) {
WARN_PRINT ( " Your compiler doesn't seem to support lockless atomics. Performance will be degraded. Please consider upgrading to a different or newer compiler. " ) ;
}
}
# endif