EnterCriticalSection

Waits for ownership of a critical section object.

void EnterCriticalSection (LPCRITICAL_SECTION lock);

Required Header
<process.h>

Return Value

None.

Parameters

lock

  Pointer to a critical section object

Remarks

The EnterCriticalSection function waits for the critical section pointed to by lock to become available and when it becomes available takes ownership of the critical section object.

Care must be used with critical sections, and this function, to prevent a thread from deadlocking itself by waiting for a critical section it already owns.

Process and Threads

See Also    InitialiseCriticalSection, LeaveCriticalSection