Here is the problem Im having.  I have background task, that is small enough to 
use a lambda on a given string.

std::list< yyy > xxx;
for( auto && ii : xxx )
{
     QThreadPool::globalInstance()->start(
        [ii]()
        {
            doSomething( ii );
        } );
}

Works great for this... However, I want the application waiting until all 
threads are completed before exiting the tool.

while (QThreadPool::globalInstance()->activeThreadCount())
{
        QThreadPool::globalInstance()->waitForDone(100);
        qApp->processEvents();
}

Should work.  Wait 100ms, and continue.

However, the problem Im having, is activeThreadCount does not take into account 
queued threads.

Is there a better way?  The length of the xxx can be in the millions, and is 
recursive.

Scott

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to