[Development] QIntrusiveSharedPointer

Philippe philwave at gmail.com
Thu Aug 8 11:23:02 CEST 2019


> You are assumed to have an outside synchronization when using most Qt classes 
> across multiple threads. Most are not inherently thread safe, especially not 
> the implicitly shared ones.

Yes for mutations upon a given instance of an implictly shared object.
But any const method are safe to be called concurrently (any method that
does not implicitly call detach()).

Therefore, qIntrusiveDetached() which is const, would be an exception
that needs outside synchronization to get a reliable result.

Philippe

On Thu, 08 Aug 2019 10:46:17 +0200
Allan Sandfeld Jensen <kde at carewolf.com> wrote:

> On Thursday, 8 August 2019 10:29:41 CEST Philippe wrote:
> > Yet, what is the usefullness of qIntrusiveDetached()?
> > Because the result depends on a relaxed load, hence the moment after
> > qIntrusiveDetached() was evaluated, rechecking qIntrusiveDetached()
> > could give a different result.
> > 
> You are assumed to have an outside synchronization when using most Qt classes 
> across multiple threads. Most are not inherently thread safe, especially not 
> the implicitly shared ones.
> 
> 'Allan
> 




More information about the Development mailing list