File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,6 @@ class ThreadManager
206
206
pthread_mutex_t m_manager_access_mutex;
207
207
208
208
static const char m_env_name[];
209
- static const unsigned int m_default_number_of_threads;
210
209
211
210
work_load m_work_load;
212
211
@@ -223,14 +222,6 @@ class ThreadManager
223
222
224
223
const char ThreadManager::m_env_name[] = " OPENCV_FOR_THREADS_NUM" ;
225
224
226
- #ifdef ANDROID
227
- // many modern phones/tables have 4-core CPUs. Let's use no more
228
- // than 2 threads by default not to overheat the devices
229
- const unsigned int ThreadManager::m_default_number_of_threads = 2 ;
230
- #else
231
- const unsigned int ThreadManager::m_default_number_of_threads = 8 ;
232
- #endif
233
-
234
225
ForThread::~ForThread ()
235
226
{
236
227
if (m_state == eFTStarted)
@@ -534,7 +525,15 @@ void ThreadManager::setNumOfThreads(size_t n)
534
525
535
526
size_t ThreadManager::defaultNumberOfThreads ()
536
527
{
537
- unsigned int result = m_default_number_of_threads;
528
+ #ifdef ANDROID
529
+ // many modern phones/tables have 4-core CPUs. Let's use no more
530
+ // than 2 threads by default not to overheat the devices
531
+ const unsigned int default_number_of_threads = 2 ;
532
+ #else
533
+ const unsigned int default_number_of_threads = (unsigned int )std::max (1 , cv::getNumberOfCPUs ());
534
+ #endif
535
+
536
+ unsigned int result = default_number_of_threads;
538
537
539
538
char * env = getenv (m_env_name);
540
539
You can’t perform that action at this time.
0 commit comments