| 797 | } |
| 798 | |
| 799 | int 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 |
| 822 | ThreadPool::ThreadPool() { |
nothing calls this directly
no test coverage detected