Can Q_GLOBAL_STATIC replace KStaticDelete ?

Thiago Macieira thiago at
Fri Jan 19 06:48:16 GMT 2007

Matthias Kretz wrote:
>> And that's where QBasicAtomicPointer comes in (not QAtomicPointer
>> because that isn't POD). It allows us to atomically set the pointer
>> without the need for a guard variable.
>How about using the code below for doing what Q_GLOBAL_STATIC is
> supposed to do (it could use a little more logic to return 0 after
> destruction, but that's not necessary here). The idea is to use
> QBasicAtomicPointer to guard against concurrent initialization of the
> local static:

The code looks good.

Simple, effective, easy to read.

  Thiago Macieira  -  thiago (AT) - thiago (AT)
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list