#ifndef HGL_ATOMIC_INCLUDE #define HGL_ATOMIC_INCLUDE #include #if HGL_OS == HGL_OS_Windows #include #elif (HGL_OS == HGL_OS_macOS)||(HGL_OS == HGL_OS_Android) #include template using atom=std::atomic; #elif defined(__GNUC__) #if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1) || __GNUC__ > 4) && (defined(__x86_64__) || defined(__i386__) || defined(__powerpc__)) #include #else #include #endif// #endif// //ps.1:老旧的Linux/32bit下原子仅支持24位,但我们设定为不支持旧的Linux //ps.2:使用GCC 4.1内置宏实现的AtomicGNU的不支持doubel型处理,如需支持,则尽可能不要用atom_double //ps..........GCC4.7/4.8/4.9下如果使用c++11的atomic会造成一些valgrind-memcheck报错,所以暂不使用。待valgrind更新 namespace hgl { #if (HGL_OS == HGL_OS_Windows)//&&(!defined(HGL_ATOMIC_CPP11)) typedef atom_win32 atom_int; typedef atom_win32 atom_uint; typedef atom_win32 atom_int32; typedef atom_win32 atom_uint32; typedef atom_win64 atom_int64; typedef atom_win64 atom_uint64; typedef atom_win32 atom_float; // typedef atom_win64 atom_double; typedef atom_win32 atom_bool; typedef atom_win32 atom_char; typedef atom_win32 atom_uchar; // typedef atom_win32 atom_wchar; typedef atom_win32 atom_char16; // typedef atom_win32 atom_char32; #else typedef atom atom_bool; typedef atom atom_int; typedef atom atom_uint; typedef atom atom_int32; typedef atom atom_uint32; typedef atom atom_int64; typedef atom atom_uint64; typedef atom atom_float; // typedef atom atom_double; typedef atom atom_char; typedef atom atom_uchar; // typedef atom atom_wchar; typedef atom atom_char16; // typedef atom atom_char32; #endif//windows & !c++11 }//namespace hgl #endif//HGL_ATOMIC_INCLUDE