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

Konstantin Shegunov kshegunov at gmail.com
Fri Oct 27 12:44:32 CEST 2017


On Fri, Oct 27, 2017 at 9:45 AM, Elvis Stansvik <elvstone at gmail.com> wrote:
>
> QMap isn't thread safe, so I don't think your use is guaranteed to be
> safe, even if you're only reading.
>

You're right, in the formal sense of the word, but if there are no
`mutable` members or `const_cast` usage a reentrant class can be used from
different threads IF the calls are read-only. I sometimes use `QHash` like
this where I need to read from a pre-populated hash from different threads,
with the understanding there's no need to lock something if the memory is
never changed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171027/08ae6fa3/attachment.html>


More information about the Interest mailing list