[Development] Is Qt allowed caching the home dir path?
Thiago Macieira
thiago.macieira at intel.com
Sun Oct 27 23:58:11 CET 2013
On segunda-feira, 28 de outubro de 2013 00:38:51, Jiergir Ogoerg wrote:
> Probably, but then afaik it either (a) somehow can create barriers or (b)
> implements
> a broken but good enough solution like DCLP (double checked locking
> pattern),
> I couldn't figure out cause it uses Qt specific macros and functions.
It has two implementations:
1) using a mutex by QMutexPool, with a non-broken double-checked locking
(because the flag is stored in a QBasicAtomicInt)
2) using the compiler's thread-safe function-local static initialisation, if
supported
Both solutions work fine, with no barrier or lock in the standard case.
What's more, Q_GLOBAL_STATIC is in use *everywhere* throughout Qt. If it were
broken, we'd have a lot more trouble than caching the home path.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131027/ba3acf31/attachment.sig>
More information about the Development
mailing list