]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/critsect.tex
Added periods
[wxWidgets.git] / docs / latex / wx / critsect.tex
CommitLineData
6e6110ee
VZ
1\section{\class{wxCriticalSection}}\label{wxcriticalsection}
2
2b5f62a0 3A critical section object is used for exactly the same purpose as
520d1936 4\helpref{mutexes}{wxmutex}. The only difference is that under Windows platform
6e6110ee
VZ
5critical sections are only visible inside one process, while mutexes may be
6shared between processes, so using critical sections is slightly more
7efficient. The terminology is also slightly different: mutex may be locked (or
8acquired) and unlocked (or released) while critical section is entered and left
9by the program.
10
11Finally, you should try to use
12\helpref{wxCriticalSectionLocker}{wxcriticalsectionlocker} class whenever
13possible instead of directly using wxCriticalSection for the same reasons
14\helpref{wxMutexLocker}{wxmutexlocker} is preferrable to
15\helpref{wxMutex}{wxmutex} - please see wxMutex for an example.
16
17\wxheading{Derived from}
18
19None.
20
954b8ae6
JS
21\wxheading{Include files}
22
23<wx/thread.h>
24
a7af285d
VZ
25\wxheading{Library}
26
27\helpref{wxBase}{librarieslist}
28
6e6110ee
VZ
29\wxheading{See also}
30
b82827dd 31\helpref{wxThread}{wxthread}, \helpref{wxCondition}{wxcondition},
12b55afa 32\helpref{wxCriticalSectionLocker}{wxcriticalsectionlocker}
6e6110ee
VZ
33
34\latexignore{\rtfignore{\wxheading{Members}}}
35
36\membersection{wxCriticalSection::wxCriticalSection}\label{wxcriticalsectionctor}
b82827dd 37
6e6110ee
VZ
38\func{}{wxCriticalSection}{\void}
39
40Default constructor initializes critical section object.
41
42\membersection{wxCriticalSection::\destruct{wxCriticalSection}}\label{wxcriticalsectiondtor}
b82827dd 43
6e6110ee
VZ
44\func{}{\destruct{wxCriticalSection}}{\void}
45
2edb0bde 46Destructor frees the resources.
6e6110ee
VZ
47
48\membersection{wxCriticalSection::Enter}\label{wxcriticalsectionenter}
b82827dd 49
6e6110ee
VZ
50\func{void }{Enter}{\void}
51
52Enter the critical section (same as locking a mutex). There is no error return
53for this function. After entering the critical section protecting some global
54data the thread running in critical section may safely use/modify it.
55
56\membersection{wxCriticalSection::Leave}\label{wxcriticalsectionleave}
b82827dd 57
6e6110ee
VZ
58\func{void }{Leave}{\void}
59
60Leave the critical section allowing other threads use the global data protected
61by it. There is no error return for this function.
b82827dd 62