Marc Mutz wrote:
> Ivan was talking about thread-safe classes. You need to lock a mutex to
> take the copy.

Returning a QMap instead of a std::shared_ptr<std::map> would be perfectly 
thread-safe there. The atomic reference counting would ensure that any 
thread that wants to write to the data that another thread still holds would 
detach first.

The only way to be thread-unsafe with a QMap would be to explicitly bypass 
the implicit sharing by using something like std::shared_ptr<QMap>, which of 
course doesn't make sense.

        Kevin Kofler

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to