Review Request: Replace thread usage with local event loop in kio/kio/hostinfo.cpp

Thomas Zander zander at kde.org
Mon Aug 8 19:31:25 BST 2011


On Monday 08 August 2011 18.35.13 Dawit A wrote:
> #2. The original functions in this class were non-blocking. It is only
> the new function I added that is a blocking call. And that is required
> because of the need for a timeout when doing name lookups from the
> urifilter plugins. Thos plugins perform a job that is time critical
> and as such cannot be impeded by name lookups that will take too long
> and hence the need for a timeout. If QHostInfo offered such interface,
> then there will be no need for the newly added functions.

Maybe naive; but would it not be simpler to wrap the Qt method like this? 

  const int id = QHostInfo::lookupHost ( hostname, receiver,  slot);
  QTimer::singleshot(timeout, QHostInfo::abortHostLookup (id );

And do we really want a public API doing that?
I would guess a private (or non exported) method in kio and/or khtml can do 
that.

-- 
Thomas Zander




More information about the kde-core-devel mailing list