diff --git a/src/coreclr/vm/ceemain.cpp b/src/coreclr/vm/ceemain.cpp index c2704acb8d4913..f3a8796aa12f36 100644 --- a/src/coreclr/vm/ceemain.cpp +++ b/src/coreclr/vm/ceemain.cpp @@ -1759,17 +1759,16 @@ static void __stdcall FiberDetachCallback(void* lpFlsData) } } -bool InitFlsSlot() +void InitFlsSlot() { // We use fiber detach callbacks to run our thread shutdown code because the fiber detach // callback is made without the OS loader lock g_flsIndex = FlsAlloc(FiberDetachCallback); if (g_flsIndex == FLS_OUT_OF_INDEXES) { - return false; + _ASSERTE(!"Initialization of an FLS slot failed."); + COMPlusThrowWin32(); } - - return true; } // Register the thread with OS to be notified when thread is about to be destroyed diff --git a/src/coreclr/vm/ceemain.h b/src/coreclr/vm/ceemain.h index fec164ea3920b7..69ba92d692d6d2 100644 --- a/src/coreclr/vm/ceemain.h +++ b/src/coreclr/vm/ceemain.h @@ -47,7 +47,7 @@ void ThreadDetaching(); void EnsureTlsDestructionMonitor(); #ifdef TARGET_WINDOWS -bool InitFlsSlot(); +void InitFlsSlot(); bool OsDetachThread(void* thread); #endif diff --git a/src/coreclr/vm/threads.cpp b/src/coreclr/vm/threads.cpp index 849a891f03bcda..7ffb9f4746d94a 100644 --- a/src/coreclr/vm/threads.cpp +++ b/src/coreclr/vm/threads.cpp @@ -1049,10 +1049,7 @@ void InitThreadManager() CONTRACTL_END; #ifdef TARGET_WINDOWS - if (!InitFlsSlot()) - { - _ASSERTE_ALL_BUILDS(!"Initialization of a FLS slot failed."); - } + InitFlsSlot(); #endif // All patched helpers should fit into one page.