[Qt-interest] How to use QFuture for my own thread implementation?

Anthony Serdyukov uksus70+qt at gmail.com
Tue Apr 20 13:13:49 CEST 2010


Is it possible and right to use QFuture for cases not related to threading?
Here are details.

Component1 asks Component2 for something. That thing is not available at the
moment. To give the result Component1 has to make HTTP request, wait for
response, then process that response using QtConcurrent::run, and after that
the desired result is ready!

I'd like Component1 to return QFuture<ResultType> which would incapsulate
all described operations.
Is it possible? And is it proper usage of QFuture infrastructure?

2010/3/21 Thiago Macieira <thiago at kde.org>

> Em Domingo 21. Março 2010, às 13.29.25, feudenfer escreveu:
> > QFuture perfectly fits for asynchronous execution, I'd like to use it for
> > my own implementations of this case. I.e. not only for QtConcurrent::run,
> > but for any case using this pattern, for my own classes that are derived
> > from QThread.
> >
> > I haven't found any way to do so with QFuture... Anybody has a suggestion
> ?
> >
> > It would be very useful to have some internal interface between QFuture
> and
> > a thread. Unfortunately right now I have to implement my own classes that
> > look like QFuture and work with my own multi-thread algorithms.
>
> You need to use the undocumented internal classes of QtConcurrent to do
> that.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>  Senior Product Manager - Nokia, Qt Development Frameworks
>      PGP/GPG: 0x6EF45358; fingerprint:
>      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100420/91ca65d5/attachment.html 


More information about the Qt-interest-old mailing list