[Development] API review for a new QDnsResolver class

Jeremy Lainé jeremy.laine at m4x.org
Wed Nov 9 18:05:52 CET 2011


This talk about QtConcurrent has me wondering: do we need an asynchronous API at all?

The underlying system calls are blocking anyway, and we could maybe have a very simple API like:

QDnsInfo QDnsInfo::lookup(QDnsInfo::RecordType type, const QString &domain)

And if you want asynchronous calls you would use QtConcurrent::run(). An open question: can you use QtConcurrent::run() on a class static method?

Benefits of this DNS API:

- QDnsInfo is just a data container (using QSharedData) for an answer,  it does not need to be a QObject and we have very simple ownership semantics

- the DNS API is not dependent on QtConcurrent, but using them together is straightforward

Any thoughts?

Jeremy


More information about the Development mailing list