> On 6 Sep 2024, at 22:36, Thiago Macieira <thiago.macie...@intel.com> wrote:
> 
> On Friday 6 September 2024 16:21:56 CEST Mårten Nordheim via Development 
> wrote:
>> But do we make it QList<int> _just in case_ there are multiple results
>> added?
> 
> From my limited exposure to QFuture/QPromise and in particular the bugs I've 
> had to triage, that is a design flaw.
> 
> The future/promise doesn't know how many results will be provided, so there's 
> a race condition in it flagging the future has arrived with more results 
> arriving.


QFuture is QGenerator in disguise.

Can we make it std::optional<T>? co_await awaits the next result, which might 
turn out to 
be "no result” (we don’t know at the time of the co_await call). Would that 
work?

Even in the case of a single result only that can still be “no result” in case 
of
cancellation, which again would suggest using an optional.

Morten


-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to