[Development] QAtomicInteger default implementations

Thiago Macieira thiago.macieira at intel.com
Tue Jun 23 17:40:27 CEST 2015


On Tuesday 23 June 2015 14:12:36 Mike Krus wrote:
> Hi
> 
> while investigating crashes in QAtomicInteger<quint64> on iOS, I was
> wondering why the default is not the use the C++11 implementation if it’s
> available? 

Because the quality of the implementation varies a lot. They first showed up in 
GCC 4.6 but were lockless atomics only for x86. In GCC 4.7, they were 
lockless, but full barrier for other architectures. It wasn't until GCC 4.8 
that they began really working.

Then ICC had a bug with constexpr, causing dynamic initialisation of all 
atomics in unspecified order.

So it's probably been working for about a year, on Linux.

> In particular, in qbasicatomic.h, the asm-based implementations
> are preferred for all arm platforms (and others). Shouldn’t the version
> using std::atomic be preferred?

We should switch, eventually. It just hasn't happened yet due to the quality 
of those std::atomic implementations.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list