2
0
mirror of https://github.com/boostorg/thread.git synced 2026-02-11 12:12:12 +00:00

thread: physical_concurrency - windows xp does not provide GetLogicalProcessorInformation

This commit is contained in:
Tim Blechmann
2014-11-29 11:43:36 +01:00
parent 83f38ea52c
commit 14c5cff2ee

View File

@@ -529,11 +529,12 @@ namespace boost
unsigned thread::physical_concurrency() BOOST_NOEXCEPT
{
#if BOOST_PLAT_WINDOWS_RUNTIME
#if BOOST_PLAT_WINDOWS_RUNTIME \
|| ( BOOST_USE_WINAPI_VERSION <= BOOST_WINAPI_VERSION_WINXP ) \ // a bit too strict: Windows XP with SP3 would be sufficient
|| ( defined(__MINGW32__) && !defined(__MINGW64__) )
return hardware_concurrency();
#else
unsigned cores = 0;
#if !(defined(__MINGW32__) || defined (__MINGW64__))
DWORD size = 0;
GetLogicalProcessorInformation(NULL, &size);
@@ -550,7 +551,6 @@ namespace boost
if (buffer[i].Relationship == RelationProcessorCore)
++cores;
}
#endif
return cores;
#endif
}