[thiago at kde.org: Re: Multiple QRegExp crashes when multithreading in KRunner]

Andreas Pakulat apaku at gmx.de
Fri Jan 14 08:00:49 UTC 2011


Hi,

see below, its a much more elegant solution than using a mutex and
possibly faster too. So maybe we can use this to get rid of the mutex in
the cmake manager for the regexp's its using?

Andreas

----- Forwarded message from Thiago Macieira <thiago at kde.org> -----

Date: Fri, 14 Jan 2011 01:17:24 +0100
From: Thiago Macieira <thiago at kde.org>
To: kde-core-devel at kde.org
Subject: Re: Multiple QRegExp crashes when multithreading in KRunner
User-Agent: KMail/4.6 beta3 (Linux/2.6.35.6-desktop-1mnb; KDE/4.5.86; i686;
	git-3cbb929; 2010-12-23)

On Thursday, 13 de January de 2011 23:33:14 Milian Wolff wrote:
> Matthias Fuchs, 13.01.2011:
> > Hi,
> > 
> > There are some crashes related to QRegExp and multithreading, so they
> > appear when using KRunner.
> 
> QRegExp is not threadsafe, you either have to guard it with a mutex or make
> sure it's not shared between threads.

You're right.

To be clear: as per Qt terminology, QRegExp is reentrant, not thread-safe.

That means you can use QRegExp in different threads, at the same time, provided 
that they point to different objects. If it's the same object, do as Milian 
said.

It's easier to just create a copy in this case.
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



----- End forwarded message -----

-- 
Future looks spotty.  You will spill soup in late evening.




More information about the KDevelop-devel mailing list