pcbnew: Force at least one connectivity thread
We want to keep at most 1 thread per 2 connectivity updates but we need
to force that floor to be at least 1 for when there is only 1
connectivity update.
Fixes: lp:1795245
* https://bugs.launchpad.net/kicad/+bug/1795245
(cherry picked from commit 89a3d2b451
)
This commit is contained in:
parent
13a41f11eb
commit
9837d1624f
|
@ -93,13 +93,14 @@ void CONNECTIVITY_DATA::updateRatsnest()
|
|||
size_t numDirty = std::count_if( m_nets.begin() + 1, m_nets.end(), [] ( RN_NET* aNet )
|
||||
{ return aNet->IsDirty(); } );
|
||||
|
||||
// Start with net 1 as net 0 is reserved for not-connected
|
||||
std::atomic<size_t> nextNet( 1 );
|
||||
std::atomic<size_t> threadsFinished( 0 );
|
||||
|
||||
// We don't want to spin up a new thread for fewer than two nets (overhead costs)
|
||||
size_t parallelThreadCount = std::min<size_t>(
|
||||
std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
|
||||
numDirty / 2 );
|
||||
( numDirty + 1 ) / 2 );
|
||||
|
||||
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue