summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-11-25 11:04:27 +0100
committerJan Vorlicek <janvorli@microsoft.com>2015-11-25 13:24:35 +0100
commita845b01e3688fd981101f953fef41641264d5403 (patch)
tree4ad80c19338bbe13af93595e152dbe8d71464ce0 /src
parent0279dbd600e14d88cfe87408f08f6adce59d2d8d (diff)
downloadcoreclr-a845b01e3688fd981101f953fef41641264d5403.tar.gz
coreclr-a845b01e3688fd981101f953fef41641264d5403.tar.bz2
coreclr-a845b01e3688fd981101f953fef41641264d5403.zip
Make app shutdown wait for secondary threads
This change makes the CoreCLR behavior the same as the desktop CLR w.r.t. the app shutdown and secondary threads. Now the application waits for secondary threads to exit before exiting.
Diffstat (limited to 'src')
-rw-r--r--src/vm/appdomain.cpp2
-rw-r--r--src/vm/appdomainnative.cpp2
-rw-r--r--src/vm/assembly.cpp4
-rw-r--r--src/vm/assembly.hpp2
-rw-r--r--src/vm/corhost.cpp4
5 files changed, 7 insertions, 7 deletions
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index 1aa549c333..a868babc40 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -3693,7 +3693,7 @@ void SystemDomain::ExecuteMainMethod(HMODULE hMod, __in_opt LPWSTR path /*=NULL*
pDomain->GetMulticoreJitManager().AutoStartProfile(pDomain);
#endif
- pDomain->m_pRootAssembly->ExecuteMainMethod(NULL);
+ pDomain->m_pRootAssembly->ExecuteMainMethod(NULL, FALSE /* waitForOtherThreads */);
}
pThread->ReturnToContext(&frame);
diff --git a/src/vm/appdomainnative.cpp b/src/vm/appdomainnative.cpp
index 6dd2ffd6f7..ebc7d3339d 100644
--- a/src/vm/appdomainnative.cpp
+++ b/src/vm/appdomainnative.cpp
@@ -538,7 +538,7 @@ INT32 AppDomainNative::ExecuteAssemblyHelper(Assembly* pAssembly,
EE_TRY_FOR_FINALLY(Param *, pParam, &param)
{
- pParam->iRetVal = pParam->pAssembly->ExecuteMainMethod(pParam->pStringArgs);
+ pParam->iRetVal = pParam->pAssembly->ExecuteMainMethod(pParam->pStringArgs, TRUE /* waitForOtherThreads */);
}
EE_FINALLY
{
diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp
index 45045e1bce..4043353e77 100644
--- a/src/vm/assembly.cpp
+++ b/src/vm/assembly.cpp
@@ -2649,7 +2649,7 @@ static void RunMainPost()
}
}
-INT32 Assembly::ExecuteMainMethod(PTRARRAYREF *stringArgs)
+INT32 Assembly::ExecuteMainMethod(PTRARRAYREF *stringArgs, BOOL waitForOtherThreads)
{
CONTRACTL
{
@@ -2722,7 +2722,7 @@ INT32 Assembly::ExecuteMainMethod(PTRARRAYREF *stringArgs)
//to decide when the process should get torn down. So, don't call it from
// AppDomain.ExecuteAssembly()
if (pMeth) {
- if (stringArgs == NULL)
+ if (waitForOtherThreads)
RunMainPost();
}
else {
diff --git a/src/vm/assembly.hpp b/src/vm/assembly.hpp
index 1fdc655c02..b017fb8386 100644
--- a/src/vm/assembly.hpp
+++ b/src/vm/assembly.hpp
@@ -500,7 +500,7 @@ public:
//****************************************************************************************
//
- INT32 ExecuteMainMethod(PTRARRAYREF *stringArgs);
+ INT32 ExecuteMainMethod(PTRARRAYREF *stringArgs, BOOL waitForOtherThreads);
//****************************************************************************************
diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp
index 4d6515d6d2..bb6404cb38 100644
--- a/src/vm/corhost.cpp
+++ b/src/vm/corhost.cpp
@@ -1345,7 +1345,7 @@ HRESULT CorHost2::ExecuteAssembly(DWORD dwAppDomainId,
arguments->SetAt(i, argument);
}
- DWORD retval = pAssembly->ExecuteMainMethod(&arguments);
+ DWORD retval = pAssembly->ExecuteMainMethod(&arguments, TRUE /* waitForOtherThreads */);
if (pReturnValue)
{
*pReturnValue = retval;
@@ -2555,7 +2555,7 @@ VOID CorHost2::ExecuteMainInner(Assembly* pRootAssembly)
// since this is the thread 0 entry point for AppX apps we use
// the EntryPointFilter so that an unhandled exception here will
// trigger the same behavior as in classic apps.
- pParam->pRootAssembly->ExecuteMainMethod(NULL);
+ pParam->pRootAssembly->ExecuteMainMethod(NULL, FALSE /* waitForOtherThreads */);
}
PAL_EXCEPT_FILTER(EntryPointFilter)
{