0
点赞
收藏
分享

微信扫一扫

C++获取CPU核心数(用来初始化线程池)

我是小瘦子哟 2022-01-12 阅读 44
c++

std::thread::hardware_concurrency()该函数返回CPU核心的数量,当系统无法获取时,函数返回0 

#include <thread>

unsigned int nCpu = std::max(std::thread::hardware_concurrency(),(unsigned int)1);
举报

相关推荐

0 条评论