diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2016-02-09 15:08:42 +0300 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2016-02-10 22:47:17 +0300 |
commit | 8d00b434b2c7cc0b7a9cb1eb0a57006ae9c76ace (patch) | |
tree | 8d4a954e9f13605be393da924fb4b71e9f4592b3 /src/Native/Runtime/startup.cpp | |
parent | 5462e47d416ed48ee5d2d06e837a13e3c3006e70 (diff) |
Refactor FLS usage in PAL
This change abstracts the FLS usage for thread shutdown notification in PAL into a
general thread shutdown callback registration mechanism. It also implements its
Unix version.
Diffstat (limited to 'src/Native/Runtime/startup.cpp')
-rw-r--r-- | src/Native/Runtime/startup.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/Native/Runtime/startup.cpp b/src/Native/Runtime/startup.cpp index 389f3dbcf..a76dfb43a 100644 --- a/src/Native/Runtime/startup.cpp +++ b/src/Native/Runtime/startup.cpp @@ -39,7 +39,6 @@ UInt32 _fls_index = FLS_OUT_OF_INDEXES; Int32 __stdcall RhpVectoredExceptionHandler(PEXCEPTION_POINTERS pExPtrs); -void __stdcall FiberDetach(void* lpFlsData); void CheckForPalFallback(); extern RhConfig * g_pRhConfig; @@ -74,10 +73,6 @@ bool InitDLL(HANDLE hPalInstance) return false; STARTUP_TIMELINE_EVENT(NONGC_INIT_COMPLETE); - _fls_index = PalFlsAlloc(FiberDetach); - if (_fls_index == FLS_OUT_OF_INDEXES) - return false; - // @TODO: currently we're always forcing a workstation GC. // @TODO: GC per-instance vs per-DLL state separation if (!RedhawkGCInterface::InitializeSubsystems(RedhawkGCInterface::GCType_Workstation)) @@ -214,13 +209,13 @@ void DllThreadDetach() } } -void __stdcall FiberDetach(void* lpFlsData) +void __stdcall RuntimeThreadShutdown(void* thread) { // Note: loader lock is *not* held here! - UNREFERENCED_PARAMETER(lpFlsData); - ASSERT(lpFlsData == PalFlsGetValue(_fls_index)); + UNREFERENCED_PARAMETER(thread); + ASSERT((Thread*)thread == ThreadStore::GetCurrentThread()); - ThreadStore::DetachCurrentThreadIfHomeFiber(); + ThreadStore::DetachCurrentThread(); } COOP_PINVOKE_HELPER(UInt32_BOOL, RhpRegisterModule, (ModuleHeader *pModuleHeader)) |