Use std::thread::hardware_concurrency() to detect the core number on your compture.

tf_hardware_cores()