[Development] Looking for Feedback QDeferred

Juan Gonzalez Burgos juangburgos at gmail.com
Mon Feb 11 21:26:42 CET 2019


Maybe I should clarify that QLambdaThreadWorker/QDeferred was designed with
an specific use-case, namely mid/long-term living threads.
For example, a long-living network client in a request/response cycle, or a
class constantly handling time-consuming file operations, etc.
The class to handle that client is meant to "own" the QLambdaThreadWorker,
therefore sharing the same life-time.
If I was gonna batch-process a chuck of data, I would definetively use
thread pools to do that in parallel and forget about thread life-time and
ownership.
As you said it would be faster, less expensive.
QLambdaThreadWorker/QDeferred was never meant to be the solution for all
threaded problems, just one more tool in your threads toolbox.
Thank you for making see that I didn't mention that, I will try to clarify
it somewhere.

I couldn't agree more with you and that post of function colors. Indeed
promises should be a thing from the past, and I also believe co-routines
are the solution.
But I think they are officially coming until 2020 to C++? (Did I mentioned
I am stuck at work using VS2013 compiler?)
And how would they interact with Qt? I have seen some experiments here and
there:
https://blog.qt.io/blog/2018/05/29/playing-coroutines-qt/
http://jefftrull.github.io/qt/c++/coroutines/2018/07/21/coroutines-and-qt.html
In the mean time QDeferred has made my life a little bit easier, but indeed
I will say goodbye to it when co-routines take over the Qt world!

Thanks for the feedback


On Mon, Feb 11, 2019 at 8:31 PM Jason H <jhihn at gmx.com> wrote:

> What are the costs of thread start-up?
> Why is this not a QRunnable (In my experience Runnables start faster than
> treads - though it may be anecdotal)
> How does it interact with thread pools?
>
> I cringe when I see Promises in 2019. Node/JS uses them because they
> (until recently) only had one thread they could run on. We don't have this
> limitation in Qt. I'm on board with easy lambda threading. I'm not on board
> with more Promises.
> http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
>
>
>
>
> *Sent:* Monday, February 11, 2019 at 6:49 AM
> *From:* "Juan Gonzalez Burgos" <juangburgos at gmail.com>
> *To:* development at qt-project.org
> *Subject:* [Development] Looking for Feedback QDeferred
> Hi guys,
>
> Sorry to bother you with yet another promise/deferred library for Qt. I am
> looking for feedback.
>
> https://github.com/juangburgos/QDeferred
>
> Thanks.
> _______________________________________________ Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190211/3e9359d6/attachment.html>


More information about the Development mailing list