> Thanks Jason, > I understand the need of EnterCriticalSection() if both > threads sharing > memory, but if for example one thread is calling a function that is only > reading the memory, and the other thread updates it, is > EnterCriticalSection() still needed as only one is updating it?
It definitely IS needed in that case... imagine if one thread was halfway through writing the memory and hadn't finished updating memory - and then another thread cut in and tried reading... it could get messy. The reading thread might end up reading mismatched data, because only half of it had finished being written at the time. Make sense? Memory blocks need protecting just the same as variables - for the exact same reasons - after all, a variable is just a small memory block. -- Jason Teagle [EMAIL PROTECTED] _______________________________________________ msvc mailing list [email protected] See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.
