diff --git a/include/sdsl/util.hpp b/include/sdsl/util.hpp index c47d3f88..16496d23 100644 --- a/include/sdsl/util.hpp +++ b/include/sdsl/util.hpp @@ -9,6 +9,7 @@ #define INCLUDED_SDSL_UTIL #include +#include #include #include #include @@ -345,15 +346,10 @@ inline char * str_from_errno() #endif } -struct _id_helper_struct +inline uint64_t _id_helper() { - uint64_t id = 0; -}; - -extern inline uint64_t _id_helper() -{ - static _id_helper_struct data; - return data.id++; + static std::atomic id{0u}; + return id++; } //! Get the process id of the current process