Locking issues in mutlilang branches (due to LanguageController changes)

Milian Wolff mail at milianw.de
Fri Aug 6 13:28:43 UTC 2010


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

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/ffd68955/attachment.sig>


More information about the KDevelop-devel mailing list