Browse Source

Fix a hang-up during zone filling

On OpenMP single core systems only the first thread launched. It means
that only the UI updating thread was running, without the one
responsible for actual computation. It is fixed by enforcing at least
two threads.
pull/5/merge
Maciej Suminski 8 years ago
parent
commit
86566fc142
  1. 7
      pcbnew/connectivity_algo.cpp
  2. 6
      pcbnew/zone_filler.cpp

7
pcbnew/connectivity_algo.cpp

@ -32,6 +32,10 @@
#include <profile.h>
#endif
#ifdef USE_OPENMP
#include <omp.h>
#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

6
pcbnew/zone_filler.cpp

@ -116,7 +116,8 @@ void ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> 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<ZONE_CONTAINER*> 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

Loading…
Cancel
Save