MCPcopy Create free account
hub / github.com/apache/arrow / DefaultCapacity

Method DefaultCapacity

cpp/src/arrow/util/thread_pool.cc:799–819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

797}
798
799int ThreadPool::DefaultCapacity() {
800 int capacity = ParseOMPEnvVar("OMP_NUM_THREADS");
801 if (capacity <= 0) {
802 capacity = static_cast<int>(GetNumAffinityCores().ValueOr(0));
803 }
804 if (capacity <= 0) {
805 capacity = static_cast<int>(std::thread::hardware_concurrency());
806 }
807 if (capacity <= 0) {
808 capacity = 4;
809 ARROW_LOG(WARNING) << "Failed to determine the number of available threads, "
810 "using a hardcoded arbitrary value of "
811 << capacity;
812 }
813
814 const int limit = ParseOMPEnvVar("OMP_THREAD_LIMIT");
815 if (limit > 0) {
816 capacity = std::min(limit, capacity);
817 }
818 return capacity;
819}
820
821#else // ARROW_ENABLE_THREADING
822ThreadPool::ThreadPool() {

Callers

nothing calls this directly

Calls 3

ParseOMPEnvVarFunction · 0.85
GetNumAffinityCoresFunction · 0.85
ValueOrMethod · 0.80

Tested by

no test coverage detected