[Development] Question about QCoreApplicationData::*_libpaths

Matthew Woehlke mwoehlke.floss at gmail.com
Fri Jan 22 19:37:22 CET 2016


On 2016-01-22 13:02, Bubke Marco wrote:
> Actually what is happen if I am in the middle of changing a qvector,  and then copying the vector in an other thread? 

Are you concurrently modifying and copying *the same* vector, or a
shallow copy that, under the hood, happens to be shared? The latter is
no problem; as soon as you try to modify the vector, it will detach, and
they'll cease being shared. The one that's just being copied is not
modified.

If you really have *the same* vector... Don't do that :-). Note that
this implies that you are either operating on the same variable, or one
thread is operating on a reference. That's not very common, and it's
just not thread safe, ever¹, regardless of the data type.

(¹ Well, besides atomic types, but we're talking about containers...)

-- 
Matthew




More information about the Development mailing list