summaryrefslogtreecommitdiff
path: root/src/vm/ceeload.cpp
diff options
context:
space:
mode:
authorBrian Sullivan <briansul@microsoft.com>2017-04-06 17:36:15 -0700
committerBrian Sullivan <briansul@microsoft.com>2017-04-06 17:36:15 -0700
commitded541455690dbd7707ed281388bcaa314c76f9f (patch)
treefe0286411998f9ed7f97af287d89de10c7f7554e /src/vm/ceeload.cpp
parent9c74cbac6c86f2c484c7ebd4c81a6aee6bd7cc25 (diff)
downloadcoreclr-ded541455690dbd7707ed281388bcaa314c76f9f.tar.gz
coreclr-ded541455690dbd7707ed281388bcaa314c76f9f.tar.bz2
coreclr-ded541455690dbd7707ed281388bcaa314c76f9f.zip
Fix shutdown A/V issue when IBC logging with the Music Store app
This app continues to run managed code on other threads after the Main thread exits and enters shutdown. We now block IBC logging during the time that we are writing out the IBC data.
Diffstat (limited to 'src/vm/ceeload.cpp')
-rw-r--r--src/vm/ceeload.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp
index 0845d8608f..5de7114eb1 100644
--- a/src/vm/ceeload.cpp
+++ b/src/vm/ceeload.cpp
@@ -3586,8 +3586,21 @@ void Module::StartUnload()
}
#endif // PROFILING_SUPPORTED
#ifdef FEATURE_PREJIT
- // Write out the method profile data
- /*hr=*/WriteMethodProfileDataLogFile(true);
+ if (g_IBCLogger.InstrEnabled())
+ {
+ Thread * pThread = GetThread();
+ ThreadLocalIBCInfo* pInfo = pThread->GetIBCInfo();
+
+ // Acquire the Crst lock before creating the IBCLoggingDisabler object.
+ // Only one thread at a time can be processing an IBC logging event.
+ CrstHolder lock(g_IBCLogger.GetSync());
+ {
+ IBCLoggingDisabler disableLogging( pInfo ); // runs IBCLoggingDisabler::DisableLogging
+
+ // Write out the method profile data
+ /*hr=*/WriteMethodProfileDataLogFile(true);
+ }
+ }
#endif // FEATURE_PREJIT
SetBeingUnloaded();
}