"Hello everyone. I want to know if it is safe to acces read-only a global variable (shared resource) without protecting it with a mutex (C++)."
As long as every thread is accessing the variable as read only then you do not need to lock on the global variable. However if any thread updates the variable then all threads which update the variable must use an exclusive lock and all threads which are read only on the global variable must use a shared lock.
-------------------------
Steve Stites
|