mirror of
https://github.com/Relintai/osxcross.git
synced 2025-04-11 17:32:38 +02:00
12 lines
250 B
C++
12 lines
250 B
C++
#include <iostream>
|
|
#include <thread>
|
|
|
|
/** Print number of (enabled) CPU cores.
|
|
*
|
|
* Requires C++11 or better.
|
|
*/
|
|
int main() {
|
|
unsigned int numcpus = std::thread::hardware_concurrency();
|
|
std::cout << (numcpus > 0 ? numcpus : 1) << std::endl;
|
|
}
|