/dev/null wrote:
I'm not sure about that. If this were true, why ::InterlockedIncrement( )?

The InterlockedIncrement( ) function does an atomic copy, so it's impossible for the reader thread to get an outdated value. But simply declaring the variable as volatile doesn't prevent that from happening. The only thing it does is ensuring the compiler doesn't cache the variable's values in registers and fetch it from the main memory each time it's being accessed.


--
Ehsan Akhgari
Farda Technology <http://www.farda-tech.com/>

#ifdef TRUE
#define  TRUE   0
#define  FALSE  1
#endif

_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to