Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2016-02-09 15:08:42 +0300
committerJan Vorlicek <janvorli@microsoft.com>2016-02-10 22:47:17 +0300
commit8d00b434b2c7cc0b7a9cb1eb0a57006ae9c76ace (patch)
tree8d4a954e9f13605be393da924fb4b71e9f4592b3 /src/Native/Runtime/startup.cpp
parent5462e47d416ed48ee5d2d06e837a13e3c3006e70 (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.cpp13
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))