VOID EnterCriticalSection(lpcs) | |||||
LPCRITICAL_SECTION lpcs; | /* address of critical section object | */ |
The EnterCriticalSection gives a thread access to the specified critical section object.
lpcs
Points to the critical section object to access.
Critical sections are typically used to control access to a resource. When a thread needs the protected resource, it calls the EnterCriticalSection function to request ownership of the object. If another thread already owns the critical section object, this function will block until the critical section has been released. If the critical section object is currently unowned, the system grants ownership to the requesting thread and it can access the resource. When it has finished executing the protected code, the thread uses the LeaveCriticalSection function to relinquish ownership of the Critical Section, thereby allowing another thread to become owner.
LeaveCriticalSection, InitializeCriticalSection, DeleteCriticalSection