async: Ensure threads are started async

It is possible for an async thread to simply be deferred if not
specifically set to async.  In which case, until the return value is
requested, the loop may simply wait.
This commit is contained in:
Seth Hillbrand 2018-10-26 22:30:06 -07:00
parent 59fb6d8851
commit ed1c8eee9e
2 changed files with 3 additions and 2 deletions

View File

@ -246,7 +246,8 @@ void CN_CONNECTIVITY_ALGO::searchConnections()
else
{
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
returns[ii] = std::async( conn_lambda, &m_itemList, m_progressReporter );
returns[ii] = std::async( std::launch::async, conn_lambda,
&m_itemList, m_progressReporter );
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
{

View File

@ -125,7 +125,7 @@ void CONNECTIVITY_DATA::updateRatsnest()
else
{
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
returns[ii] = std::async( update_lambda );
returns[ii] = std::async( std::launch::async, update_lambda );
// Finalize the ratsnest threads
for( size_t ii = 0; ii < parallelThreadCount; ++ii )