You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
would it be possible to add API or an example on how to wrap promises of different types? E.g. to handle a scenario such as:
do A returning a_t
do B returning b_t
await for A and B then do C taking a_t and b_t.
Ideally something like this:
auto a = qPromise(QtConcurrent::run([](){return QStringLiteral("foo");}));
auto b = qPromise(QtConcurrent::run([](){return 42;}));
qPromiseAll(a, b).then([](const QString &str, int num) {});
I believe one could handle this manually by building a promise that stores a tuple of return args (here QString and int) as well as a counter to check how many of the child promises have been fulfilled. Then when a child promise is fulfilled store its return type and decrement the counter, and if that reaches zero resolve the parent promise? And if any child promise gets rejected, also reject the parent promise?
The text was updated successfully, but these errors were encountered:
Hey there,
would it be possible to add API or an example on how to wrap promises of different types? E.g. to handle a scenario such as:
Ideally something like this:
I believe one could handle this manually by building a promise that stores a tuple of return args (here QString and int) as well as a counter to check how many of the child promises have been fulfilled. Then when a child promise is fulfilled store its return type and decrement the counter, and if that reaches zero resolve the parent promise? And if any child promise gets rejected, also reject the parent promise?
The text was updated successfully, but these errors were encountered: