Older Newer
Sat, 05 Jul 2008 10:48:47 . . . . afh [Add comment]

Changes by last author:

= enterCriticalSection =

== Syntax ==

:bool enterCriticalSection(int hCS)

== Arguments ==


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

== Return ==

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

== Description ==

: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].

== Example[[Anchor example]] ==

:See the createCriticalSection example.

== Also see ==

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

== Comments ==

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

* One need not normally test the return value of enterCriticalSection. This is merely a check to make sure that hCS is non-zero so the EnterCriticalSection Win32 API won't cause a memory access violation.