Older Newer
Sat, 16 Nov 2019 02:51:11 . . . . SyneRyder [Update MSDN link, formatting]


Changes by last author:

Added:
= leaveCriticalSection =

== Syntax ==

bool leaveCriticalSection(int hCS)

== Arguments ==

:hCS

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

== Comments ==

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.

== Example ==

See the createCriticalSection example.

== See Also ==

System Functions, createCriticalSection, enterCriticalSection, tryEnterCriticalSection, deleteCriticalSection