Context
I have a long running process returning a result. This result may need further processing. There can also be multiple results ready simultaneously. Each one of these results that needs further processing may take a while too.
I need to take each one of those results, throw each into a queue of sorts and process each one, with the ability to start/stop this process.
Problem:
At the moment, I am limited to using a QFuture with a QFutureWatcher and using either a QtConcurrent::mapped() or QtConcurrent::run() function (the latter which doesn't support direct pause/stop functionality, see note below).
The problem with the approech(es) mentioned above is it requires all results to be known up front, however to decrease the overall processing time, I would like to process each result as it comes in.
How can I effectively process create a thread pool with a queue of tasks?