Prevent halting the main GUI thread

This commit is contained in:
Seth Hillbrand 2022-12-05 11:09:44 -08:00
parent 0089df8ca4
commit d8f94962ff
1 changed files with 14 additions and 1 deletions

View File

@ -418,9 +418,22 @@ bool ZONE_FILLER::Fill( std::vector<ZONE*>& aZones, bool aCheck, wxWindow* aPare
}
// Make sure that all futures have finished.
// This can happen when the user cancels the above operation
for( auto& ret : returns )
{
if( ret.first.valid() )
ret.first.wait();
{
std::future_status status = ret.first.wait_for( std::chrono::seconds( 0 ) );
while( status != std::future_status::ready )
{
if( m_progressReporter )
m_progressReporter->KeepRefreshing();
status = ret.first.wait_for( std::chrono::milliseconds( 100 ) );
}
}
}
// Now update the connectivity to check for isolated copper islands
// (NB: FindIsolatedCopperIslands() is multi-threaded)