Older Newer
Sat, 05 Jul 2008 10:58:20 . . . . afh [change return value; add comment]

Changes by last author:

= leaveCriticalSection =

== Syntax ==

:bool leaveCriticalSection(int hCS)

== Arguments ==


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

== Return ==

:This function returns true after immediately relinquishing ownership of the Critical Section. It returns false if hCS is zero.

== Description ==

:This function exits a specified Critical Section, thereby relinquishing ownership of it and allowing another waiting thread to enter the Critical Section. Critical Sections must be exited in the reverse order in which they were entered. It is an error to exit a Critical Section that is not owned by the current thread. A thread may enter a specific Critical Section several times (i.e., in a nested or recursive fashion), in which case it must also exit the Critical Section the same number of times before another thread can gain access to it.



: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, enterCriticalSection, tryEnterCriticalSection, deleteCriticalSection

== Comments ==

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

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