Introduction - If you have any usage issues, please Google them yourself
First of all, in the main thread InitializeCriticalSection () to initialize the critical partition. Then create two sub-threads, in two sub-thread count of global variables, respectively, using the EnterCriticalSection () to enter the critical section, and LeaveCriticalSection () to exit the critical section. The two sub-thread has finished running, the main thread to use DeleteCriticalSection () to delete the critical section and revoke the thread.