I’m running a QTConcurrent::Map on a list of items to perform some image processing tasks. This works well on a machine with just a few threads but runs in to problems on machines with a large number of threads due to the memory requirements of my processing code.
Is it possible to set the maximum number of concurrent threads for QTConcurrent operations or do I need to re-code with a QThreadPool where I have more control?
Thanks for any advice.
QtConcurrent::mapuses the global thread pool.You can change its thread count with
QThreadPool::globalInstance()->setMaxThreadCount(n).