[Interest] QMap crash when using QtConcurrent::blockingMapped()

Elvis Stansvik elvstone at gmail.com
Fri Oct 27 20:14:35 CEST 2017


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)

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.

Elvis

[1] http://doc.qt.io/qt-5/threads-reentrancy.html

>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list