X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6e6110ee8194ee39944dffd57cce9f22cd8b961e..43f06cfda107a4a74776b58dca3353a4414ecfb1:/docs/latex/wx/crtslock.tex diff --git a/docs/latex/wx/crtslock.tex b/docs/latex/wx/crtslock.tex index 6a62153d4b..1bfa41ea9e 100644 --- a/docs/latex/wx/crtslock.tex +++ b/docs/latex/wx/crtslock.tex @@ -6,24 +6,58 @@ constructor and leaves it in the destructor making it much more difficult to forget to leave a critical section (which, in general, will lead to serious and difficult to debug problems). +Example of using it: + +\begin{verbatim} +void Set Foo() +{ + // gs_critSect is some (global) critical section guarding access to the + // object "foo" + wxCriticalSectionLocker locker(gs_critSect); + + if ( ... ) + { + // do something + ... + + return; + } + + // do something else + ... + + return; +} +\end{verbatim} + +Without wxCriticalSectionLocker, you would need to remember to manually leave +the critical section before each {\tt return}. + \wxheading{Derived from} None. +\wxheading{Include files} + + + \wxheading{See also} -\helpref{wxCriticalSection}{wxcriticalsection}, +\helpref{wxCriticalSection}{wxcriticalsection}, \helpref{wxMutexLocker}{wxmutexlocker} \latexignore{\rtfignore{\wxheading{Members}}} \membersection{wxCriticalSectionLocker::wxCriticalSectionLocker}\label{wxcriticalsectionlockerctor} -\func{}{wxCriticalSectionLocker}{\param{wxCriticalSection *}{criticalsection}} + +\func{}{wxCriticalSectionLocker}{\param{wxCriticalSection\& }{criticalsection}} Constructs a wxCriticalSectionLocker object associated with given -criticalsection which must be non NULL and enters it. +{\it criticalsection} and enters it. \membersection{wxCriticalSectionLocker::\destruct{wxCriticalSectionLocker}}\label{wxcriticalsectionlockerdtor} + \func{}{\destruct{wxCriticalSectionLocker}}{\void} -Destuctor leaves the criticalsection. +Destructor leaves the critical section. +