DosEnterCriticalSection & DosExitCriticalSection

These API's will serialize all threads in a process. They have no effect on threads in other processes. At the time control returns from DosEnterCriticalSection, no other thread in the process is allowed to execute (there is an exception to this which is when is signal is sent to a process). Looking at the threads' status, one may see 'crt'. This is NOT the thread that entered critical section. Threads in the 'crt' state are ready to run but are temporarily held because of the existence of the thread in critical section. The critical section thread may block, but is the only thread in that process which is allowed to run. Only when that thread issues the DosExitCriticalSection are the other threads released, and again allowed to compete for use of the processor. This is really too much serialization for most situations, because it temporarily disables multithreading in the process, regardless of the other threads' design, or current actual processing.


[Back: Multiprocessor Methods - Spin Locks]
[Next: DosSuspendThread & DosResumeThread]