Compilation fix for wxStopWatch with wxUSE_THREADS==0.

Use wxCRIT_SECT_DECLARE_MEMBER/wxCRIT_SECT_LOCKER macros which expand to
nothing in wxUSE_THREADS==0 case instead of using wxCriticalSection[Locker]
classes which are not defined then.

Also explicitly include wx/thread.h.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70012 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-12-15 21:13:03 +00:00
parent 5dec941a5b
commit 0c717dd16b

View File

@@ -37,6 +37,7 @@
#include "wx/msw/wrapwin.h" #include "wx/msw/wrapwin.h"
#endif #endif
#include "wx/log.h" #include "wx/log.h"
#include "wx/thread.h"
#endif //WX_PRECOMP #endif //WX_PRECOMP
// ============================================================================ // ============================================================================
@@ -64,7 +65,7 @@ struct PerfCounter
return freq.QuadPart != 0; return freq.QuadPart != 0;
} }
wxCriticalSection cs; wxCRIT_SECT_DECLARE_MEMBER(cs);
LARGE_INTEGER freq; LARGE_INTEGER freq;
bool init; bool init;
} gs_perfCounter; } gs_perfCounter;
@@ -82,7 +83,7 @@ void wxStopWatch::DoStart()
#ifdef __WXMSW__ #ifdef __WXMSW__
if ( !gs_perfCounter.init ) if ( !gs_perfCounter.init )
{ {
wxCriticalSectionLocker lock(gs_perfCounter.cs); wxCRIT_SECT_LOCKER(lock, gs_perfCounter.cs);
::QueryPerformanceFrequency(&gs_perfCounter.freq); ::QueryPerformanceFrequency(&gs_perfCounter.freq);
// Just a sanity check: it's not supposed to happen but verify that // Just a sanity check: it's not supposed to happen but verify that