2
votes

In terms of C++11, am I correct in thinking that copy of value-semantic objects that is shared between at least two threads isn't thread safe?

Meaning that if we want to get a copy of an big object in a thread, we still need some synchronisation mecanism to make the copy?

2
A shared but read-only does not necessitate synchronization (thought I would precise it).Matthieu M.

2 Answers

5
votes

Meaning that if we want to get a copy of an big object in a thread, we still need some synchronisation mecanism to make the copy?

Yes. If the object is accessed (written to) from other threads and you want to copy it, you have to ensure the access is synchronized.

1
votes

Thread-safety is only relevant in the context of shared objects. If the object to be copied is only accessible to the thread that is copying it, then no synchronisation is required.