[Interest] QMap crash when using QtConcurrent::blockingMapped()
Thiago Macieira
thiago.macieira at intel.com
Fri Oct 27 20:22:39 CEST 2017
On Friday, 27 October 2017 11:14:35 PDT Elvis Stansvik wrote:
> 2017-10-27 19:03 GMT+02:00 Thiago Macieira <thiago.macieira at intel.com>:
> > On Friday, 27 October 2017 09:43:57 PDT Elvis Stansvik wrote:
> >> Reentrant in the object oriented context of Qt means: It's safe to
> >> call member functions from different threads _if_ the calls are made
> >> on different instances.
> >>
> >> In your case you were making calls on the same instance.
> >
> > Calling const functions on the same instance is safe, provided no other
> > threads are calling non-const functions.
> >
> > He was calling a non-const function.
>
> Alright. Thanks for clarifying. Is that a guarantee that holds for all
> classes marked reentrant in Qt? (that const functions are safe even
> when called on the same instance)
I can't say for sure. Most of them will be like that, and definitely all the
containers.
There may be a few bugs here and there, code that does const_cast and needs to
be fixed.
> If so, maybe the docs page I linked should be updated to mention this [1].
>
> I thought that Qt wanted to reserve the right to do thread unsafe
> stuff even in const functions, and that was the reason for the
> definition of reentrant explained there.
I will reject any change that tries to do that. But we may still have some of
them lying around. For example:
https://github.com/qt/qt/blob/4.8/src/corelib/global/qglobal.h#L2088-L2090
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Interest
mailing list