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

David Faure faure at kde.org
Tue Aug 9 15:30:43 BST 2011


On Tuesday 09 August 2011 17:19:49 Olivier Goffart wrote:
> The proper thing to use here is a QWaitCondition

Which is easy to write racy code with (if B calls wake() before A calls 
wait(), A missed the notification for good and it will sleep forever), so I 
usually prefer a QSemaphore (which uses a QMutex and a QWaitCondition 
internally, but which is easier to use since it encapsulates all this nicely).

Then A (main thread) can acquire, B (worker thread) can release, in any order.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).





More information about the kde-core-devel mailing list