#include <wx/thread.h>
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:
Without wxCriticalSectionLocker, you would need to remember to manually leave the critical section before each return
.
Public Member Functions | |
wxCriticalSectionLocker (wxCriticalSection &criticalsection) | |
Constructs a wxCriticalSectionLocker object associated with given criticalsection and enters it. More... | |
~wxCriticalSectionLocker () | |
Destructor leaves the critical section. More... | |
wxCriticalSectionLocker::wxCriticalSectionLocker | ( | wxCriticalSection & | criticalsection | ) |
Constructs a wxCriticalSectionLocker object associated with given criticalsection and enters it.
wxCriticalSectionLocker::~wxCriticalSectionLocker | ( | ) |
Destructor leaves the critical section.