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

Dawit A adawit at kde.org
Mon Aug 8 17:35:13 BST 2011


On Mon, Aug 8, 2011 at 11:25 AM, Thiago Macieira <thiago at kde.org> wrote:
> On Monday, 8 de August de 2011 14:25:13 David Faure wrote:
>> And since I just fixed the crash (missing wait() after terminate(), see
>> commit log), I don't think we need this change. However reusing threads
>> might be a good idea (separate issue).
>
> This could probably use a redesign. If this class only handles requests coming
> from the ioslave, why does it need to be blocking? Can't it be non-blocking
> and send the result back later?

#1. The class is not only used by ioslaves, but also khtml's DNS
prefetch code (where it originated IIRC) and also KUriFilter's plugin
classes, more specifically the localdomain and fixhost filters located
under kdebase/kde-runtime/kurifilter-plugins.

#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.




More information about the kde-core-devel mailing list