Thread-safety when calling IProject::projectItem() and IBuildSystemManager::includeDirectories()
Andreas Pakulat
apaku at gmx.de
Sat Apr 17 06:33:43 UTC 2010
On 16.04.10 16:39:45, Sandro Andrade wrote:
> Hi all,
>
> I'm currently running some race conditions when calling
> IProject::projectItem() and IBuildSystemManager::includeDirectories()
> from different simultaneous threads, in controlglowgraph plugin.
>
> I added a mutex to serialize these calls and apparently crashes were solved:
>
> KDevelop::ProjectBaseItem *project_item = 0;
> {
> QMutexLocker locker (&mutex);
> if (m_currentProject)
> project_item = m_currentProject->projectItem();
> }
>
> KUrl::List list;
> {
> QMutexLocker locker (&mutex);
> list = buildSystemManager->includeDirectories( project_item
> );
> }
>
> So, are really these methods not thread-safe ?
They're not. In fact no code in kdevplatform is threadsafe, except for
duchain.
Andreas
--
You'd like to do it instantaneously, but that's too slow.
More information about the KDevelop-devel
mailing list