From Mathias Froehlich, "Tha attached change adapt previous attemps to get our application using osg
through microsofts application verifier. The current change should work a little better ... The change is based on rev 10605."
This commit is contained in:
parent
972e68113d
commit
058d31d7b5
@ -205,7 +205,10 @@ namespace OpenThreads {
|
|||||||
|
|
||||||
Thread* Thread::CurrentThread()
|
Thread* Thread::CurrentThread()
|
||||||
{
|
{
|
||||||
return (Thread* )TlsGetValue(Win32ThreadPrivateData::TLS.getId());
|
DWORD ID = Win32ThreadPrivateData::TLS.getId();
|
||||||
|
if (ID == TLS_OUT_OF_INDEXES)
|
||||||
|
return 0;
|
||||||
|
return (Thread* )TlsGetValue(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -71,18 +71,21 @@ public:
|
|||||||
struct TlsHolder{ // thread local storage slot
|
struct TlsHolder{ // thread local storage slot
|
||||||
DWORD getId()
|
DWORD getId()
|
||||||
{
|
{
|
||||||
static bool initialized = false;
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
ID = TlsAlloc();
|
ID = TlsAlloc();
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
TlsHolder() : ID(TLS_OUT_OF_INDEXES), initialized(false) {}
|
||||||
~TlsHolder(){
|
~TlsHolder(){
|
||||||
TlsFree(ID);
|
if (initialized)
|
||||||
|
TlsFree(ID);
|
||||||
|
ID = TLS_OUT_OF_INDEXES;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
DWORD ID;
|
DWORD ID;
|
||||||
|
bool initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
static TlsHolder TLS;
|
static TlsHolder TLS;
|
||||||
|
Loading…
Reference in New Issue
Block a user