chanegd wxTlsValue to be pointer-like instead of value-like which doesn't work for UDTs; use __thread keyword with mingw32 >= 4.3 too; use library-based thread-specific variables support in wxString cache now that it is fixed to work there; finally added a unit test for TLS stuff

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55361 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-08-29 23:28:42 +00:00
parent b18f47d002
commit 8b73c5318c
17 changed files with 320 additions and 83 deletions

View File

@@ -11,9 +11,6 @@
#ifndef _WX_MSW_TLS_H_
#define _WX_MSW_TLS_H_
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/msw/wrapwin.h"
// ----------------------------------------------------------------------------
@@ -27,8 +24,6 @@ public:
wxTlsKey()
{
m_slot = ::TlsAlloc();
if ( m_slot == TLS_OUT_OF_INDEXES )
wxLogError("Creating TLS key failed");
}
// return true if the key was successfully allocated
@@ -43,25 +38,14 @@ public:
// change the key value, return true if ok
bool Set(void *value)
{
if ( !::TlsSetValue(m_slot, value) )
{
wxLogSysError(_("Failed to set TLS value"));
return false;
}
return true;
return ::TlsSetValue(m_slot, value) != 0;
}
// free the key
~wxTlsKey()
{
if ( IsOk() )
{
if ( !::TlsFree(m_slot) )
{
wxLogDebug("TlsFree() failed: %08x", ::GetLastError());
}
}
::TlsFree(m_slot);
}
private: