.\" This is a wxWidgets manpage page generated from the XML docs .TH wxCriticalSectionLocker 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxCriticalSectionLocker \- Critical section locker utility class .SH DESCRIPTION This is a small helper class to be used with wxCriticalSection objects. A wxCriticalSectionLocker enters the critical section in the 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: 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; } Without wxCriticalSectionLocker, you would need to remember to manually leave the critical section before each return . .SH "PARENTS" .SH "INCLUDE FILES" wx/thread.h .SH MEMBERS .SS wxCriticalSectionLocker (wxCriticalSection& criticalsection) Constructs a wxCriticalSectionLocker object associated with given criticalsection and enters it. .SS ~wxCriticalSectionLocker () Destructor leaves the critical section. .SH "SEE ALSO" wxCriticalSection wxMutexLocker .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.