public static member function
<thread>
std::thread::hardware_concurrency
static unsigned hardware_concurrency() noexcept;
Detect hardware concurrency
Returns the number of hardware thread contexts.
The interpretation of this value is system- and implementation- specific, and may not be exact, but just an approximation.
Note that this does not need to match the actual number of processors or cores available in the system: A system can support multiple threads per processing unit, or restrict the access to its resources to the program.
If this value is not computable or well defined, the function returns 0
.
Return value
A hint on the number of hardware thread contexts.
Or zero, if this value is not computable or well defined.
Exception safety
No-throw guarantee: never throws exceptions.