]>
Commit | Line | Data |
---|---|---|
6e6110ee VZ |
1 | \section{\class{wxMutexLocker}}\label{wxmutexlocker} |
2 | ||
3 | This is a small helper class to be used with \helpref{wxMutex}{wxmutex} | |
4 | objects. A wxMutexLocker acquires a mutex lock in the constructor and releases | |
5 | (or unlocks) the mutex in the destructor making it much more difficult to | |
90e572f1 | 6 | forget to release a mutex (which, in general, will promptly lead to serious |
6e6110ee VZ |
7 | problems). See \helpref{wxMutex}{wxmutex} for an example of wxMutexLocker |
8 | usage. | |
9 | ||
10 | \wxheading{Derived from} | |
11 | ||
12 | None. | |
13 | ||
954b8ae6 JS |
14 | \wxheading{Include files} |
15 | ||
16 | <wx/thread.h> | |
17 | ||
a7af285d VZ |
18 | \wxheading{Library} |
19 | ||
20 | \helpref{wxBase}{librarieslist} | |
21 | ||
6e6110ee VZ |
22 | \wxheading{See also} |
23 | ||
2432b92d | 24 | \helpref{wxMutex}{wxmutex}, \helpref{wxCriticalSectionLocker}{wxcriticalsectionlocker} |
6e6110ee VZ |
25 | |
26 | \latexignore{\rtfignore{\wxheading{Members}}} | |
27 | ||
28 | \membersection{wxMutexLocker::wxMutexLocker}\label{wxmutexlockerctor} | |
2432b92d | 29 | |
047f39de | 30 | \func{}{wxMutexLocker}{\param{wxMutex\&}{ mutex}} |
6e6110ee | 31 | |
047f39de VZ |
32 | Constructs a wxMutexLocker object associated with mutex and locks it. |
33 | Call \helpref{IsLocked}{wxmutexlockerisok} to check if the mutex was | |
6e6110ee VZ |
34 | successfully locked. |
35 | ||
36 | \membersection{wxMutexLocker::\destruct{wxMutexLocker}}\label{wxmutexlockerdtor} | |
2432b92d | 37 | |
6e6110ee VZ |
38 | \func{}{\destruct{wxMutexLocker}}{\void} |
39 | ||
2edb0bde | 40 | Destructor releases the mutex if it was successfully acquired in the ctor. |
6e6110ee VZ |
41 | |
42 | \membersection{wxMutexLocker::IsOk}\label{wxmutexlockerisok} | |
2432b92d | 43 | |
6e6110ee VZ |
44 | \constfunc{bool}{IsOk}{\void} |
45 | ||
cc81d32f | 46 | Returns true if mutex was acquired in the constructor, false otherwise. |
2432b92d | 47 |