[Development] Unnecessary ambiguity in Qt documentation about reentrancy and safety of const methods.
Giuseppe D'Angelo
giuseppe.dangelo at kdab.com
Sun Jul 19 00:36:06 CEST 2026
On 19/07/2026 00:19, NIkolai Marchenko wrote:
> > to call the same function, on the same data, from multiple threads,
> without synchronization, provided that any shared data is accessed
> exclusively along const paths
>
> I think something went wrong with the wording here. "Same function, on
> the same instance, from multiple threads..."
"Same instance" is part of the "same data". For non-static member
functions, the `this` pointer (the instance) belongs to the data the
function is accessing.
But I was imprecise on another axis: the extended contract means you can
even call *different* functions on the same data, provided all those
functions access shared data along const paths. This would be the case
for e.g. different const methods of a class, being called at the same
time on the same instance.
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 - Trusted Software Excellence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4850 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/development/attachments/20260719/7ef68403/attachment.bin>
More information about the Development
mailing list