Hi! I've got two questions about SFML's threads and mutexes.
First, a general question about sharing variables and objects between threads. Is it necessary to use mutexes to lock an object both when you're reading and writing to it or is it enough just locking it when you write to it. In other words, what happens if a thread is reading an object, that is not locked, and then another thread wants to lock and write to it? It seems much more efficient to just lock it only when you need to change it, otherwise, the program may end up spending more time locking and unlocking an object just to get read and write access to it.
My second question is about functions(and methods as well) and threads. What happens if a thread wants to use a function at the same time as another? Is it necessary and possible to use mutexes to lock and unlock access to functions aswell?