mirror of
https://github.com/opencv/opencv.git
synced 2026-07-28 23:03:03 +04:00
Merge pull request #19985 from fpetrogalli:disable_threads
* [build][option] Introduce `OPENCV_DISABLE_THREAD_SUPPORT` option. The option forces the library to build without thread support. * update handling of OPENCV_DISABLE_THREAD_SUPPORT - reduce amount of #if conditions * [to squash] cmake: apply mode vars in toolchains too Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
This commit is contained in:
committed by
GitHub
parent
59ae0e0013
commit
b928ebdd53
@@ -72,7 +72,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined CV_CXX11
|
||||
#ifndef OPENCV_DISABLE_THREAD_SUPPORT
|
||||
#include <thread>
|
||||
#endif
|
||||
|
||||
@@ -884,6 +884,7 @@ T minNonZero(const T& val_1, const T& val_2)
|
||||
return (val_1 != 0) ? val_1 : val_2;
|
||||
}
|
||||
|
||||
#ifndef OPENCV_DISABLE_THREAD_SUPPORT
|
||||
static
|
||||
int getNumberOfCPUs_()
|
||||
{
|
||||
@@ -986,6 +987,13 @@ int getNumberOfCPUs()
|
||||
return nCPUs; // cached value
|
||||
}
|
||||
|
||||
#else // OPENCV_DISABLE_THREAD_SUPPORT
|
||||
int getNumberOfCPUs()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif // OPENCV_DISABLE_THREAD_SUPPORT
|
||||
|
||||
const char* currentParallelFramework()
|
||||
{
|
||||
std::shared_ptr<ParallelForAPI>& api = getCurrentParallelForAPI();
|
||||
|
||||
Reference in New Issue
Block a user