Chaining async calls with QFuture
Unsolved
General and Desktop
-
Hi,
Is it possible to chain async functions using QFuture chaining, e.g.:
auto future = QtFuture::connect(reply, &QNetworkReply::finished) .then([reply] { return reply->readAll(); }) .then([](const QByteArray &data) { QTimer::singleShot(1000, this, []{ call next "then" }); }) .then() { QTimer::singleShot(1000, this, []{ call next "then" }); }) .then() ...
Regards,
-
-
Why would you emit a signal and then wait for the response? If you emit a signal, you want to notify some other object and not yourself to wait (or capture the Future) again, right?
Chaining might work (not tested nor used myself).but the way your example looks, it makes no senseedit:
lol you just fixed that code :D