Use symbolic TLS_OUT_OF_INDEXES constant instead of literal one

This constant has the same value but is more readable.

No real changes.
This commit is contained in:
Vadim Zeitlin
2021-04-15 18:59:13 +01:00
parent ed23b47695
commit 5b0b50f164

View File

@@ -90,8 +90,9 @@ enum wxThreadState
// this module globals // this module globals
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// TLS index of the slot where we store the pointer to the current thread // TLS index of the slot where we store the pointer to the current thread, the
static DWORD gs_tlsThisThread = 0xFFFFFFFF; // initial value is special and means that it's not initialized yet
static DWORD gs_tlsThisThread = TLS_OUT_OF_INDEXES;
// id of the main thread - the one which can call GUI functions without first // id of the main thread - the one which can call GUI functions without first
// calling wxMutexGuiEnter() // calling wxMutexGuiEnter()
@@ -1226,7 +1227,7 @@ bool wxThreadModule::OnInit()
{ {
// allocate TLS index for storing the pointer to the current thread // allocate TLS index for storing the pointer to the current thread
gs_tlsThisThread = ::TlsAlloc(); gs_tlsThisThread = ::TlsAlloc();
if ( gs_tlsThisThread == 0xFFFFFFFF ) if ( gs_tlsThisThread == TLS_OUT_OF_INDEXES )
{ {
// in normal circumstances it will only happen if all other // in normal circumstances it will only happen if all other
// TLS_MINIMUM_AVAILABLE (>= 64) indices are already taken - in other // TLS_MINIMUM_AVAILABLE (>= 64) indices are already taken - in other
@@ -1241,7 +1242,7 @@ bool wxThreadModule::OnInit()
if ( !::TlsSetValue(gs_tlsThisThread, (LPVOID)0) ) if ( !::TlsSetValue(gs_tlsThisThread, (LPVOID)0) )
{ {
::TlsFree(gs_tlsThisThread); ::TlsFree(gs_tlsThisThread);
gs_tlsThisThread = 0xFFFFFFFF; gs_tlsThisThread = TLS_OUT_OF_INDEXES;
wxLogSysError(_("Thread module initialization failed: cannot store value in thread local storage")); wxLogSysError(_("Thread module initialization failed: cannot store value in thread local storage"));