diff --git a/pcbnew/connectivity_algo.cpp b/pcbnew/connectivity_algo.cpp index acac2d55e2..52384923b8 100644 --- a/pcbnew/connectivity_algo.cpp +++ b/pcbnew/connectivity_algo.cpp @@ -32,6 +32,10 @@ #include #endif +#ifdef USE_OPENMP +#include +#endif /* USE_OPENMP */ + using namespace std::placeholders; bool operator<( const CN_ANCHOR_PTR& a, const CN_ANCHOR_PTR& b ) @@ -521,7 +525,8 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones ) } #ifdef USE_OPENMP - #pragma omp parallel + // launch at least two threads, one to compute, second to update UI + #pragma omp parallel num_threads( std::max( omp_get_num_procs(), 2 ) ) #endif { #ifdef USE_OPENMP diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 327df69de6..7797e4a81d 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -116,7 +116,8 @@ void ZONE_FILLER::Fill( std::vector aZones ) #ifdef USE_OPENMP - #pragma omp parallel + // launch at least two threads, one to compute, second to update UI + #pragma omp parallel num_threads( std::max( omp_get_num_procs(), 2 ) ) #endif { #ifdef USE_OPENMP @@ -177,7 +178,8 @@ void ZONE_FILLER::Fill( std::vector aZones ) m_progressReporter->SetMaxProgress( toFill.size() ); } #ifdef USE_OPENMP - #pragma omp parallel + // launch at least two threads, one to compute, second to update UI + #pragma omp parallel num_threads( std::max( omp_get_num_procs(), 2 ) ) #endif { #ifdef USE_OPENMP