AntoinePrv commented on code in PR #47152: URL: https://github.com/apache/arrow/pull/47152#discussion_r2219263116
########## cpp/src/arrow/util/cpu_info.cc: ########## @@ -513,7 +526,18 @@ struct CpuInfo::Impl { OsRetrieveCacheSize(&cache_sizes); OsRetrieveCpuInfo(&hardware_flags, &vendor, &model_name); original_hardware_flags = hardware_flags; - num_cores = std::max(static_cast<int>(std::thread::hardware_concurrency()), 1); + + num_cores = static_cast<int>(std::thread::hardware_concurrency()); + if (num_cores <= 0) { + num_cores = 4; + ARROW_LOG(WARNING) << "Failed to determine the number of available threads, " + "using a hardcoded arbitrary value " + << num_cores; + } Review Comment: Moved from thread_pool.cc to standardize the detection of number of CPUs. ########## cpp/src/arrow/util/cpu_info.cc: ########## @@ -513,7 +526,18 @@ struct CpuInfo::Impl { OsRetrieveCacheSize(&cache_sizes); OsRetrieveCpuInfo(&hardware_flags, &vendor, &model_name); original_hardware_flags = hardware_flags; - num_cores = std::max(static_cast<int>(std::thread::hardware_concurrency()), 1); + + num_cores = static_cast<int>(std::thread::hardware_concurrency()); + if (num_cores <= 0) { + num_cores = 4; + ARROW_LOG(WARNING) << "Failed to determine the number of available threads, " + "using a hardcoded arbitrary value " + << num_cores; + } Review Comment: Moved from ``thread_pool.cc`` to standardize the detection of number of CPUs. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org