]> git.saurik.com Git - wxWidgets.git/blobdiff - docs/latex/wx/crtslock.tex
added null pointer check and assert
[wxWidgets.git] / docs / latex / wx / crtslock.tex
index a9515b8137201a1e96ed36c3ce76a8245b0e08d0..2bdc6a33dcb16d0db7cd30bde5162425763d143d 100644 (file)
@@ -6,6 +6,33 @@ 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).
 
 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{Derived from}
 
 None.
@@ -14,6 +41,10 @@ None.
 
 <wx/thread.h>
 
 
 <wx/thread.h>
 
+\wxheading{Library}
+
+\helpref{wxBase}{librarieslist}
+
 \wxheading{See also}
 
 \helpref{wxCriticalSection}{wxcriticalsection}, 
 \wxheading{See also}
 
 \helpref{wxCriticalSection}{wxcriticalsection}, 
@@ -23,14 +54,14 @@ None.
 
 \membersection{wxCriticalSectionLocker::wxCriticalSectionLocker}\label{wxcriticalsectionlockerctor}
 
 
 \membersection{wxCriticalSectionLocker::wxCriticalSectionLocker}\label{wxcriticalsectionlockerctor}
 
-\func{}{wxCriticalSectionLocker}{\param{wxCriticalSection *}{criticalsection}}
+\func{}{wxCriticalSectionLocker}{\param{wxCriticalSection\& }{criticalsection}}
 
 Constructs a wxCriticalSectionLocker object associated with given
 
 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}
 
 
 \membersection{wxCriticalSectionLocker::\destruct{wxCriticalSectionLocker}}\label{wxcriticalsectionlockerdtor}
 
 \func{}{\destruct{wxCriticalSectionLocker}}{\void}
 
-Destuctor leaves the criticalsection.
+Destructor leaves the critical section.