contents up previous next

wxmutexlocker

this is a small helper class to be used with wxmutex objects. a wxmutexlocker acquires a mutex lock in the constructor and releases (or unlocks) the mutex in the destructor making it much more difficult to forget to release a mutex (which, in general, will promptly lead to serious problems). see wxmutex for an example of wxmutexlocker usage.

derived from

none.

include files

<wx/thread.h>

see also

wxmutex, wxcriticalsectionlocker

members

wxmutexlocker::wxmutexlocker
wxmutexlocker::~wxmutexlocker
wxmutexlocker::isok


wxmutexlocker::wxmutexlocker

wxmutexlocker(wxmutex& mutex)

constructs a wxmutexlocker object associated with mutex and locks it. call islocked to check if the mutex was successfully locked.


wxmutexlocker::~wxmutexlocker

~wxmutexlocker()

destructor releases the mutex if it was successfully acquired in the ctor.


wxmutexlocker::isok

bool isok() const

returns true if mutex was acquired in the constructor, false otherwise.