On Tuesday, 17 August 2021 12:01:25 PDT Scott Bloom wrote: > 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(); > }
Busy-waiting is never a good idea. You should use QFuture/QFutureWatcher and react to the latter's signals indicating their jobs are done. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel DPG Cloud Engineering _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest