Introduction - If you have any usage issues, please Google them yourself
Procedures for the implementation of the principle is like this, a multi-threaded, which contains the reading and writing test.txt Notepad function.
Because the time spent reading and writing Notepad is very short, in writing Notepad, deliberately added 2S delay, resulting in obvious conflicts of multi-threaded. This multithreading is the critical area used: CRITICAL_SECTION. Press the button, thread to write a string of characters (the thread executing need more than 2S), 20ms after the delay notification thread and then write a string of characters, with the first written by "conflict", 20ms after the delay, in two did not complete the write again when the thread to read with a notebook.Thus causing three events in the thread to "fight"".