[Development] atomic reference counting implementation

Philippe philwave at gmail.com
Thu Aug 8 11:42:37 CEST 2019


> On the other hand, QSharedData's ref member is an implementation detail (the QRefCount class is even private API),
> and the semantics of ref/deref on it are undocumnted, so *that* could bechanged right now.

It is good to mention QRefCount aka QtPrivate::RefCount
except it is not used in QSharedData (QSharedData uses a "QAtomicInt ref")

All implicitly shared class should rely on a single optimized QtPrivate::RefCount
on the line of https://codereview.qt-project.org/c/qt/qtbase/+/66118

Philippe

On Wed, 7 Aug 2019 22:26:11 +0200
Giuseppe D'Angelo via Development <development at qt-project.org> wrote:

> Il 07/08/19 20:00, Mutz, Marc via Development ha scritto:
> > This was discussed in
> > https://codereview.qt-project.org/c/qt/qtbase/+/66118. See, in
> > particular, Olivier's comment.
> >
> > TL;DR: ref() is documented to be ordered, so cannot be changed.
> 
> On the other hand, QSharedData's ref member is an implementation detail (the QRefCount class is even private API), and the semantics of ref/deref on it are undocumnted, so *that* could be changed right now. Although I'd still feel very uncomfortable at doing so.
> 
> My 2 c,
> -- Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
> KDAB (France) S.A.S., a KDAB Group company
> Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
> KDAB - The Qt, C++ and OpenGL Experts
> 





More information about the Development mailing list