0

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?

CybeX
  • 2,060
  • 3
  • 48
  • 115
  • To show the result and proceed with more sub-results from that one? – Alexander V Aug 08 '20 at 22:47
  • May be [QFuture::isResultReadyAt(int index)](https://doc.qt.io/qt-5/qfuture.html#isResultReadyAt) can help? See also https://github.com/benlau/asyncfuture - AsyncFuture is designed to enhance the function to offer a better way to use it for asynchronous programming. It provides a Promise object like interface. – Vladimir Bershov Aug 09 '20 at 12:46

0 Answers0