I'm not sure what behavior you're trying to get with the addition of "volatile" as it doesn't prevent data race conditions or multi-instruction loads so frequently it doesn't accomplish what you'd think in multi-core/CPU-threaded code.  So, what's your intention here? (references: http://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming http://stackoverflow.com/questions/8819095/concurrency-atomic-and-volatile-in-c11-memory-model/8833218#8833218 http://bartoszmilewski.com/2008/12/01/c-atomics-and-memory-ordering/)