Fix Visual Studio poor std::this_thread::get_id() performance by using GetCurrentThreadId() (and pthread_self() under linux)

This commit is contained in:
gabime
2015-04-07 20:26:42 +03:00
parent 67e0957e67
commit a09107927b
5 changed files with 22 additions and 7 deletions

View File

@@ -32,6 +32,8 @@
# define WIN32_LEAN_AND_MEAN
# endif
# include <Windows.h>
#else
#include <pthread.h>
#endif
#include "../common.h"
@@ -167,6 +169,17 @@ inline int utc_minutes_offset(const std::tm& tm = details::os::localtime())
}
inline uint64_t thread_id()
{
#ifdef _WIN32
return ::GetCurrentThreadId();
#else
return (uint64_t) pthread_self();
#endif
}
} //os
} //details
} //spdlog