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.
This commit is contained in:
Maciej Suminski 2018-02-09 14:14:32 +01:00
parent c39fd46c07
commit 86566fc142
2 changed files with 10 additions and 3 deletions

View File

@ -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

View File

@ -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