Possible Duplicate:
Using C/Pthreads: do shared variables need to be volatile?
In Linux/C: Do the global variables shared between threads need to be declared volatile (assume the variable get modified in one of the threads)?
What all situations do I need to declare a variable as volatile in threads?
If you are using pthreads, then no –
volatileis neither necessary nor sufficient for correct synchronisation. If your accesses to the global variable are properly protected by a mutex (or another synchronisation primitive), then you can simply declare them as ordinary variables.