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:
parent
59fb6d8851
commit
ed1c8eee9e
|
@ -246,7 +246,8 @@ void CN_CONNECTIVITY_ALGO::searchConnections()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
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 )
|
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
||||||
{
|
{
|
||||||
|
|
|
@ -125,7 +125,7 @@ void CONNECTIVITY_DATA::updateRatsnest()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
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
|
// Finalize the ratsnest threads
|
||||||
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
for( size_t ii = 0; ii < parallelThreadCount; ++ii )
|
||||||
|
|
Loading…
Reference in New Issue