[Development] Evolving Qt's multithreading API

Thiago Macieira thiago.macieira at intel.com
Mon Mar 4 23:56:41 CET 2013


On segunda-feira, 4 de março de 2013 14.49.15, Thiago Macieira wrote:
> > I think the proposed API addition is actually quite natural. It is not
> > without precedent (QTimer::singleShot()), and would result in quite
> > simple, readable code.
> 
> I disagree on both accounts. It's not natural: there is no precedent for 
> taking two runnables outside of QtConcurrent's own reducing functions (map-
> reduce and filter-reduce). In that case, it serves a very specific purpose,
> in a  domain where the concept is understood. And besides, that's the very
> module we're trying to replace.
> 
> There's also no good API that takes two slots -- the only example I can
> think  of is the horrible QDBusConnection::callWithCallback. And that one
> is made simpler and easier by QDBusPendingReply and
> QDBusPendingCallWatcher, two classes inspired by QFuture and
> QFutureWatcher.

Oh, and if you want simple, one more thing occurred to me:

  runFunction([]() { main(); then(); });

If you need the return value:
  runFunction([]() { then(main()); });

I will not accept "C++11 isn't available for everyone" as a reason to add a 
more complicated API. The API should be designed for C++11 use and later made 
to work with C++98, with as little modification as possible.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130304/c3e370c7/attachment.sig>


More information about the Development mailing list