summaryrefslogtreecommitdiff
path: root/src/pal/src/init
diff options
context:
space:
mode:
authorMike McLaughlin <mikem@microsoft.com>2018-08-19 16:04:02 -0700
committerGitHub <noreply@github.com>2018-08-19 16:04:02 -0700
commitb2031a14a3b110f8e712abdb0cd392c54cd2e839 (patch)
tree0f3e79ae2eedf29d2be0b3cc3f42016d0e79a091 /src/pal/src/init
parentff56d33f624bee91354ebe09ab83bbc79b587536 (diff)
downloadcoreclr-b2031a14a3b110f8e712abdb0cd392c54cd2e839.tar.gz
coreclr-b2031a14a3b110f8e712abdb0cd392c54cd2e839.tar.bz2
coreclr-b2031a14a3b110f8e712abdb0cd392c54cd2e839.zip
Free the alternate signal stack if this PAL's thread allocated it. (#19539)
Free the alternate signal stack if this PAL's thread allocated it. Move Ensure/FreeSignalAlternateStack to CPalThread class. Frees the alternate stack a little sooner during thread termination.
Diffstat (limited to 'src/pal/src/init')
-rw-r--r--src/pal/src/init/sxs.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pal/src/init/sxs.cpp b/src/pal/src/init/sxs.cpp
index 3f323c6a6e..55645c941b 100644
--- a/src/pal/src/init/sxs.cpp
+++ b/src/pal/src/init/sxs.cpp
@@ -109,10 +109,16 @@ AllocatePalThread(CPalThread **ppThread)
CPalThread *pThread = NULL;
PAL_ERROR palError;
+ palError = CreateThreadData(&pThread);
+ if (NO_ERROR != palError)
+ {
+ goto exit;
+ }
+
#if !HAVE_MACH_EXCEPTIONS
// Ensure alternate stack for SIGSEGV handling. Our SIGSEGV handler is set to
// run on an alternate stack and the stack needs to be allocated per thread.
- if (!EnsureSignalAlternateStack())
+ if (!pThread->EnsureSignalAlternateStack())
{
ERROR("Cannot allocate alternate stack for SIGSEGV handler!\n");
palError = ERROR_NOT_ENOUGH_MEMORY;
@@ -120,12 +126,6 @@ AllocatePalThread(CPalThread **ppThread)
}
#endif // !HAVE_MACH_EXCEPTIONS
- palError = CreateThreadData(&pThread);
- if (NO_ERROR != palError)
- {
- goto exit;
- }
-
HANDLE hThread;
palError = CreateThreadObject(pThread, pThread, &hThread);
if (NO_ERROR != palError)