今天才知道,EnterCriticalSection对于单线程调用是不阻塞的解决方案

今天才知道,EnterCriticalSection对于单线程调用是不阻塞的
在一个线程里反复调用EnterCriticalSection,并不会阻塞,只有多线程才会。

------解决方案--------------------
After a thread has ownership of a critical section, it can make additional calls to EnterCriticalSection or TryEnterCriticalSection without blocking its execution. This prevents a thread from deadlocking itself while waiting for a critical section that it already owns. The thread enters the critical section each time EnterCriticalSection and TryEnterCriticalSection succeed. A thread must call LeaveCriticalSection once for each time that it entered the critical section.
------解决方案--------------------
好好学习,天天向上