]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/critsect.tex
Removed some TODOs in the Latex docs; changed wxMotif wxClipboard to match
[wxWidgets.git] / docs / latex / wx / critsect.tex
CommitLineData
6e6110ee
VZ
1\section{\class{wxCriticalSection}}\label{wxcriticalsection}
2
3A critical section object is used exactly for the same purpose as
4\helpref{mutexes}{wxMutex}. The only difference is that under Windows platform
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
21\wxheading{See also}
22
b82827dd 23\helpref{wxThread}{wxthread}, \helpref{wxCondition}{wxcondition},
6e6110ee
VZ
24\helpref{wxMutexLocker}{wxmutexlocker}, \helpref{wxCriticalSection}{wxcriticalsection}
25
26\latexignore{\rtfignore{\wxheading{Members}}}
27
28\membersection{wxCriticalSection::wxCriticalSection}\label{wxcriticalsectionctor}
b82827dd 29
6e6110ee
VZ
30\func{}{wxCriticalSection}{\void}
31
32Default constructor initializes critical section object.
33
34\membersection{wxCriticalSection::\destruct{wxCriticalSection}}\label{wxcriticalsectiondtor}
b82827dd 35
6e6110ee
VZ
36\func{}{\destruct{wxCriticalSection}}{\void}
37
38Destructor frees the ressources.
39
40\membersection{wxCriticalSection::Enter}\label{wxcriticalsectionenter}
b82827dd 41
6e6110ee
VZ
42\func{void }{Enter}{\void}
43
44Enter the critical section (same as locking a mutex). There is no error return
45for this function. After entering the critical section protecting some global
46data the thread running in critical section may safely use/modify it.
47
48\membersection{wxCriticalSection::Leave}\label{wxcriticalsectionleave}
b82827dd 49
6e6110ee
VZ
50\func{void }{Leave}{\void}
51
52Leave the critical section allowing other threads use the global data protected
53by it. There is no error return for this function.
b82827dd 54