Locking issues in mutlilang branches (due to LanguageController changes)

Milian Wolff mail at milianw.de
Fri Aug 6 13:33:58 UTC 2010


On Friday, 6. August 2010 15:28:43 Milian Wolff wrote:
> Hey all, esp. David.
> 
> I got an issue which you warned me of but I didn't encounter until now.
> Assume the following:
> 
> 1) Background thread (e.g. CPPInternalParseJob::run) locks DUChain
> 1) UI thread (e.g. ProblemWidget::parseJobFinished) locks DUChain
> 2) Background thread calls KDevelop::DUChainUtils::standardContextForUrl
> for a "*.moc" file (note: text/x-moc is not listed in the desktop file of
> the Cpp lang plugin?)
> 
> Since no language for *.moc was encountered until now (those files reside
> in the build dir after all), the LanguageController gets the MimeType
> (note: according to DFaure, KMimeType is supposed to be threadsafe and he
> has unit tests for that) and tries to load the plugin for it:
> 
> http://gitorious.org/+kdevelop-developers/kdevelop/devel-
> kdevplatform/blobs/multilang/shell/languagecontroller.cpp#line274
> 
> This works fine most of the time, but since the chain was first locked in
> the background thread and the UI thread is waiting for that, we get a
> deadlock.
> 
> Even if it would be possible to unlock the DUChain shortly, it would be
> potentially hazardous. So I'd have to make sure that the DUChain is _not_
> locked when trying to load a LanguageSupport.
> 
> As a workaround I've added text/x-moc to the Cpp plugin, but I'd like to
> know how to solve this "for real".

Another safety measure:
http://gitorious.org/+kdevelop-developers/kdevelop/devel-
kdevplatform/commit/6d5f350bf3359824a349d712ab823790d4303229

There could of course be more locks, e.g. the smart lock in KDE 4.x < 4.5 that 
might be locked. Should I also make sure it's not locked?

Bye
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100806/8c12f584/attachment.sig>


More information about the KDevelop-devel mailing list