Hi yeye_olive
Don't worry, we did not reinvent the wheel. We simply wrote our own BlockingMap function from the building blocks of QtConcurrent, ie.
- a QThreadPool that defaults to the global instance
- a for loop that iterates the elements and enqueues a special kind of QRunnable (see below)
- a special kind of QRunnable that wraps the function to be launched concurrently, with exception support: it calls clear on the threadpool and makes sure no further job is enqueued by the for loop if an uncaught exception is thrown from the function, and finally transfers exception to the main thread.
We tried your second suggestion but it had a problem that we did not understand: it looked like it had "inertia", since it seemed to keep starting further jobs (a lot) after the one that failed before it eventually stopped (with only a few jobs that did not execute at all).
Thanks a lot for your feedback though, we really appreciated it.
Thanks again to anda_skoa, even though we don't seem to agree on everything, your comment that we might be playing into undefined behavior was a significant step forward to us.




Reply With Quote
Bookmarks