]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/crtslock.tex
added wxWindow::AlwaysShowScrollbars() and its wxMac implementation
[wxWidgets.git] / docs / latex / wx / crtslock.tex
CommitLineData
6e6110ee
VZ
1\section{\class{wxCriticalSectionLocker}}\label{wxcriticalsectionlocker}
2
3This is a small helper class to be used with \helpref{wxCriticalSection}{wxcriticalsection}
4objects. A wxCriticalSectionLocker enters the critical section in the
5constructor and leaves it in the destructor making it much more difficult to
6forget to leave a critical section (which, in general, will lead to serious
7and difficult to debug problems).
8
5b1eea6a
VZ
9Example of using it:
10
11\begin{verbatim}
2edb0bde 12void Set Foo()
5b1eea6a
VZ
13{
14 // gs_critSect is some (global) critical section guarding access to the
15 // object "foo"
16 wxCriticalSectionLocker locker(gs_critSect);
17
18 if ( ... )
19 {
20 // do something
21 ...
22
23 return;
24 }
25
26 // do something else
27 ...
28
29 return;
30}
31\end{verbatim}
32
33Without wxCriticalSectionLocker, you would need to remember to manually leave
34the critical section before each {\tt return}.
35
6e6110ee
VZ
36\wxheading{Derived from}
37
38None.
39
954b8ae6
JS
40\wxheading{Include files}
41
42<wx/thread.h>
43
a7af285d
VZ
44\wxheading{Library}
45
46\helpref{wxBase}{librarieslist}
47
6e6110ee
VZ
48\wxheading{See also}
49
b82827dd 50\helpref{wxCriticalSection}{wxcriticalsection},
6e6110ee
VZ
51\helpref{wxMutexLocker}{wxmutexlocker}
52
53\latexignore{\rtfignore{\wxheading{Members}}}
54
55\membersection{wxCriticalSectionLocker::wxCriticalSectionLocker}\label{wxcriticalsectionlockerctor}
b82827dd 56
5b1eea6a 57\func{}{wxCriticalSectionLocker}{\param{wxCriticalSection\& }{criticalsection}}
6e6110ee
VZ
58
59Constructs a wxCriticalSectionLocker object associated with given
5b1eea6a 60{\it criticalsection} and enters it.
6e6110ee
VZ
61
62\membersection{wxCriticalSectionLocker::\destruct{wxCriticalSectionLocker}}\label{wxcriticalsectionlockerdtor}
b82827dd 63
6e6110ee
VZ
64\func{}{\destruct{wxCriticalSectionLocker}}{\void}
65
2edb0bde 66Destructor leaves the critical section.
b82827dd 67