3d-viewer: Remove threading on middle layer

The middle layer of the 3d contours does not need threading as it does
not have substantial calculations.  It also contains has a few
wx*Asserts that may not be called from other than the main thread.
Rather than remove useful error checking, we remove excess threading.

Fixes: lp:1802940
* https://bugs.launchpad.net/kicad/+bug/1802940
This commit is contained in:
Seth Hillbrand 2018-12-10 19:49:21 -08:00
parent 830dced83f
commit 0769b0409f
1 changed files with 11 additions and 32 deletions

View File

@ -306,19 +306,7 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const SHAPE_POLY_SET &aPolySet,
m_layer_middle_contourns_quads->Reserve_More( nrContournPointsToReserve * 2,
true );
std::atomic<int> nextItem( 0 );
std::atomic<size_t> threadsFinished( 0 );
size_t parallelThreadCount = std::min<size_t>(
std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
static_cast<size_t>( aPolySet.OutlineCount() ) );
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
{
std::thread t = std::thread( [&]()
{
for( int i = nextItem.fetch_add( 1 );
i < aPolySet.OutlineCount();
i = nextItem.fetch_add( 1 ) )
for( int i = 0; i < aPolySet.OutlineCount(); i++ )
{
// Add outline
const SHAPE_LINE_CHAIN& pathOutline = aPolySet.COutline( i );
@ -332,15 +320,6 @@ void CLAYER_TRIANGLES::AddToMiddleContourns( const SHAPE_POLY_SET &aPolySet,
AddToMiddleContourns( hole, zBot, zTop, aBiuTo3Du, aInvertFaceDirection );
}
}
threadsFinished++;
} );
t.detach();
}
while( threadsFinished < parallelThreadCount )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
}