[Solved] Is CRITICAL SECTION required? [closed]


A CRITICAL_SECTION is a simple sync mechanism for multi-threaded.
You use a CRITICAL_SECTION to protect a block of code from having two or more threads running it at the same time.

You will not see a difference, with or without in most cases, it is there to protected shared resources from getting run over for example:

Imagine two threads accessing resource like a block of memory at the same time, one reading an image from it while the other is writing an image to it. The reading thread will get a corrupt image.

I suggest you do some more reading on multi-threaded to better understand the concepts and how to use synchronization objects to control the flow in multi-threaded applications.

  1. http://www.codeproject.com/Articles/7953/Thread-Synchronization-for-Beginners
  2. http://msdn.microsoft.com/en-us/library/windows/desktop/ms681924(v=vs.85).aspx

1

solved Is CRITICAL SECTION required? [closed]