Using C/Pthreads: do shared variables need to be volatile?

As long as you are using locks to control access to the variable, you do not need volatile on it. In fact, if you’re putting volatile on any variable you’re probably already wrong.

https://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming/

Leave a Comment