summaryrefslogtreecommitdiff
path: root/thread_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/thread_win32.c b/thread_win32.c
index 49c143603b..2bb56d0646 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -766,6 +766,24 @@ native_reset_timer_thread(void)
}
}
+int
+ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr)
+{
+ return rb_thread_raised_p(th, RAISED_STACKOVERFLOW);
+}
+
+#if defined(__MINGW32__)
+LONG WINAPI
+rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *exception)
+{
+ if (exception->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) {
+ rb_thread_raised_set(GET_THREAD(), RAISED_STACKOVERFLOW);
+ raise(SIGSEGV);
+ }
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+#endif
+
#ifdef RUBY_ALLOCA_CHKSTK
void
ruby_alloca_chkstk(size_t len, void *sp)