I am building a multi-threaded c++ app using the boost::thread library. I am just a bit confused about when I should be using locks and mutex's. I understand that it is essential that global objects are locked before access, preventing two threads modifying the object at the same time. However, I was wondering when a mutex is actually needed.
It goes without saying that it should be used when writing or modifying an object, but is it also needed when reading or copying? Any write operations will lock the object before hand, so there should be no danger of reading from an object at the same time as it is being written. Are there any dangers with simultanious reading of the same object from different threads?