On Friday 22 January 2016 11:14:47 Marc Mutz wrote:
> On Friday 22 January 2016 09:57:00 Иван Комиссаров wrote:
> > What
> > i'm missing?
> 
> You haven't done the exercise with the int first.

Here's the exercise with int. This is thread-safe:

int f()
{
        return 1;
}

        auto x = f();
        ++x;

No matter how many threads call f(), all of them will get a value from f, can 
assign it to a variable and modify without caring what other threads do.

Replace int with QMap or QString and you have the same behaviour.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

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

Reply via email to