From: Julian Smart Date: Thu, 12 Sep 2002 08:51:01 +0000 (+0000) Subject: Don't compile crit. section code on Mac yet X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0fd28ea3dffb30ab1631784775f84ef3825c849b Don't compile crit. section code on Mac yet git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/memory.cpp b/src/common/memory.cpp index 45d0b50816..a7439bacfd 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -44,15 +44,6 @@ #include "wx/ioswrap.h" -// Obsolete -#if 0 -#if wxUSE_IOSTREAMH - #include -#else - #include -#endif -#endif - #if !defined(__WATCOMC__) && !(defined(__VMS__) && ( __VMS_VER < 70000000 ) )\ && !defined( __MWERKS__ ) && !defined(__SALFORDC__) #include @@ -76,6 +67,13 @@ #include "wx/memory.h" +#if wxUSE_THREADS && defined(__WXDEBUG__) && !defined(__WXMAC__) +#define USE_THREADSAFE_MEMORY_ALLOCATION 1 +#else +#define USE_THREADSAFE_MEMORY_ALLOCATION 0 +#endif + + #ifdef new #undef new #endif @@ -859,7 +857,7 @@ int wxDebugContext::CountObjectsLeft(bool sinceCheckpoint) return n ; } -#if wxUSE_THREADS +#if USE_THREADSAFE_MEMORY_ALLOCATION static bool memSectionOk = FALSE; class MemoryCriticalSection : public wxCriticalSection @@ -892,7 +890,7 @@ static MemoryCriticalSection memLocker; // TODO: store whether this is a vector or not. void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, bool WXUNUSED(isVect) ) { -#if wxUSE_THREADS +#if USE_THREADSAFE_MEMORY_ALLOCATION MemoryCriticalSectionLocker lock(memLocker); #endif @@ -952,7 +950,7 @@ void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, // TODO: check whether was allocated as a vector void wxDebugFree(void * buf, bool WXUNUSED(isVect) ) { -#if wxUSE_THREADS +#if USE_THREADSAFE_MEMORY_ALLOCATION MemoryCriticalSectionLocker lock(memLocker); #endif