Some information about CriticalSection

Case:

Thread A and B both will callEnterCriticalSection to get resource, currently thread B has hold the CS and dosome things, but before thread B call LeaveCriticalSection, it will sleepseveral seconds. So at that time, thread A will be wake up, and it will blockat EnterCriticalSection.


Several seconds later, thread B will bewake up and will call LeaveCriticalSection DeleteCriticalSection. So what aboutthe thread A?


Result:

Thread A will enter critical section andleave critical section normally, without any exception.


But MS say, the critical section will asundefined status after it was deleted.


你可能感兴趣的:(criticalsection)