bool enterCriticalSection(int hCS)


Specifies the handle of the Critical Section to be entered, as returned by a call to createCriticalSection.


This function returns true when access to this Critical Section is granted to the calling thread, or false if hCS is 0.


This function waits for ownership of the specified Critical Section. If another thread currently owns this Critical Section, then this function waits until the owning thread leaves the Critical Section, at which point one of the threads waiting to enter the Critical Section is granted access. If no other thread currently owns the Critical Section, the calling thread is granted immediate access.

For more information about Critical Sections, see the MSDN documentation about [Critical Section Objects].


See the createCriticalSection example.

Also see

System Functions, Critical Section Functions, createCriticalSection, tryEnterCriticalSection, leaveCriticalSection, deleteCriticalSection


Everyone can add his or her comments about his or her experiences with this function. Tips for using it are welcome, too.