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

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to