/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta/3rdparty/wxWidgets/include/wx/recguard.h
ViewVC logotype

Contents of /branch/r3113_0.9.7_beta/3rdparty/wxWidgets/include/wx/recguard.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Tue Sep 7 03:29:01 2010 UTC (9 years, 5 months ago) by william
File MIME type: text/plain
File size: 1568 byte(s)
branching from upstream revision (http://pcsx2.googlecode.com/svn/trunk
): r3113 to
https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/r3113_0.9.7_beta
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/recguard.h
3 // Purpose: declaration and implementation of wxRecursionGuard class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 14.08.2003
7 // RCS-ID: $Id: recguard.h 29243 2004-09-21 18:15:59Z ABX $
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_RECGUARD_H_
13 #define _WX_RECGUARD_H_
14
15 #include "wx/defs.h"
16
17 // ----------------------------------------------------------------------------
18 // wxRecursionGuardFlag is used with wxRecursionGuard
19 // ----------------------------------------------------------------------------
20
21 typedef int wxRecursionGuardFlag;
22
23 // ----------------------------------------------------------------------------
24 // wxRecursionGuard is the simplest way to protect a function from reentrancy
25 // ----------------------------------------------------------------------------
26
27 class WXDLLIMPEXP_BASE wxRecursionGuard
28 {
29 public:
30 wxRecursionGuard(wxRecursionGuardFlag& flag)
31 : m_flag(flag)
32 {
33 m_isInside = flag++ != 0;
34 }
35
36 ~wxRecursionGuard()
37 {
38 wxASSERT_MSG( m_flag > 0, _T("unbalanced wxRecursionGuards!?") );
39
40 m_flag--;
41 }
42
43 bool IsInside() const { return m_isInside; }
44
45 private:
46 wxRecursionGuardFlag& m_flag;
47
48 // true if the flag had been already set when we were created
49 bool m_isInside;
50 };
51
52 #endif // _WX_RECGUARD_H_
53

  ViewVC Help
Powered by ViewVC 1.1.22