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::map
uses the global thread pool.
You can change its thread count with QThreadPool::globalInstance()->setMaxThreadCount(n)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With