From e317bd3f10771eb67556b6140a1153af8ded0140 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 11 Sep 2008 06:46:23 +0000 Subject: [PATCH] solving osx problems (default inlines-hidden) by explicitely exporting the involved methods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/string.h | 16 ++++++++++------ include/wx/thread.h | 8 ++------ src/common/string.cpp | 9 +++++++++ src/unix/threadpsx.cpp | 11 ----------- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/include/wx/string.h b/include/wx/string.h index 393a190bbd..99970070b0 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -607,13 +607,13 @@ private: // enough) -- luckily we don't need it then neither as static __thread // variables are initialized by 0 anyhow then and so we can use the variable // directly - static Cache& GetCache() + WXEXPORT static Cache& GetCache() { static wxTLS_TYPE(Cache) s_cache; return wxTLS_VALUE(s_cache); } - + // this helper struct is used to ensure that GetCache() is called during // static initialization time, i.e. before any threads creation, as otherwise // the static s_cache construction inside GetCache() wouldn't be MT-safe @@ -671,11 +671,15 @@ private: // profiling seems to show a small but consistent gain if we use this // simple loop instead of starting from the last used element (there are // a lot of misses in this function...) - // during destruction tls calls may return NULL, thus return NULL - // immediately - if ( GetCacheBegin() == NULL ) + Cache::Element * const cacheBegin = GetCacheBegin(); + #if !wxHAS_COMPILER_TLS + // during destruction tls calls may return NULL, in this case return NULL + // immediately without accessing anything else + if ( cacheBegin == NULL ) return NULL; - for ( Cache::Element *c = GetCacheBegin(); c != GetCacheEnd(); c++ ) +#endif + Cache::Element * const cacheEnd = GetCacheEnd(); + for ( Cache::Element *c = cacheBegin; c != cacheEnd; c++ ) { if ( c->str == this ) return c; diff --git a/include/wx/thread.h b/include/wx/thread.h index 82ac361270..a8346d20e0 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -207,11 +207,7 @@ private: #if !defined(__WXMSW__) #define wxCRITSECT_IS_MUTEX 1 -#ifdef __WXMAC__ - #define wxCRITSECT_INLINE -#else - #define wxCRITSECT_INLINE inline -#endif + #define wxCRITSECT_INLINE WXEXPORT inline #else // MSW #define wxCRITSECT_IS_MUTEX 0 @@ -273,7 +269,7 @@ private: DECLARE_NO_COPY_CLASS(wxCriticalSection) }; -#if wxCRITSECT_IS_MUTEX && !defined(__WXMAC__) +#if wxCRITSECT_IS_MUTEX // implement wxCriticalSection using mutexes inline wxCriticalSection::wxCriticalSection( wxCriticalSectionType critSecType ) : m_mutex( critSecType == wxCRITSEC_DEFAULT ? wxMUTEX_RECURSIVE : wxMUTEX_DEFAULT ) { } diff --git a/src/common/string.cpp b/src/common/string.cpp index 13804f2211..bb5029fcf4 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -76,6 +76,15 @@ struct wxStrCacheInitializer } }; +/* +wxString::Cache& wxString::GetCache() +{ + static wxTLS_TYPE(Cache) s_cache; + + return wxTLS_VALUE(s_cache); +} +*/ + static wxStrCacheInitializer gs_stringCacheInit; #endif // wxHAS_COMPILER_TLS/!wxHAS_COMPILER_TLS diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index 99f497e9f8..692be7d169 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -67,17 +67,6 @@ #define THR_ID(thr) ((long)(thr)->GetId()) #endif -#ifdef __WXMAC__ - - // implement wxCriticalSection using mutexes -wxCriticalSection::wxCriticalSection( wxCriticalSectionType critSecType ) - : m_mutex( critSecType == wxCRITSEC_DEFAULT ? wxMUTEX_RECURSIVE : wxMUTEX_DEFAULT ) { } -wxCriticalSection::~wxCriticalSection() { } - -void wxCriticalSection::Enter() { (void)m_mutex.Lock(); } -void wxCriticalSection::Leave() { (void)m_mutex.Unlock(); } - -#endif // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- -- 2.45.2