std::thread::hardware_concurrency()该函数返回CPU核心的数量,当系统无法获取时,函数返回0
#include <thread>
unsigned int nCpu = std::max(std::thread::hardware_concurrency(),(unsigned int)1);
C++获取CPU核心数(用来初始化线程池)
阅读 45
2022-01-12
std::thread::hardware_concurrency()该函数返回CPU核心的数量,当系统无法获取时,函数返回0
#include <thread>
unsigned int nCpu = std::max(std::thread::hardware_concurrency(),(unsigned int)1);
相关推荐
精彩评论(0)