summaryrefslogtreecommitdiff
path: root/src/pal/src/thread/thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/src/thread/thread.cpp')
-rw-r--r--src/pal/src/thread/thread.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pal/src/thread/thread.cpp b/src/pal/src/thread/thread.cpp
index 53283320c5..df42ebcc96 100644
--- a/src/pal/src/thread/thread.cpp
+++ b/src/pal/src/thread/thread.cpp
@@ -28,6 +28,7 @@ SET_DEFAULT_DEBUG_CHANNEL(THREAD); // some headers have code with asserts, so do
#include "pal/handlemgr.hpp"
#include "pal/cs.hpp"
#include "pal/seh.hpp"
+#include "pal/signal.hpp"
#include "procprivate.hpp"
#include "pal/process.h"
@@ -177,6 +178,10 @@ static void InternalEndCurrentThreadWrapper(void *arg)
// in InternalEndCurrentThread.
InternalEndCurrentThread(pThread);
pthread_setspecific(thObjKey, NULL);
+
+#if !HAVE_MACH_EXCEPTIONS
+ FreeSignalAlternateStack();
+#endif // !HAVE_MACH_EXCEPTIONS
}
/*++
@@ -1659,6 +1664,14 @@ CPalThread::ThreadEntry(
goto fail;
}
+#if !HAVE_MACH_EXCEPTIONS
+ if (!EnsureSignalAlternateStack())
+ {
+ ASSERT("Cannot allocate alternate stack for SIGSEGV!\n");
+ goto fail;
+ }
+#endif // !HAVE_MACH_EXCEPTIONS
+
#if defined(FEATURE_PAL_SXS) && defined(_DEBUG)
// We cannot assert yet, as we haven't set in this thread into the TLS, and so __ASSERT_ENTER
// will fail if the assert fails and we'll crash.