summaryrefslogtreecommitdiff
path: root/thread_win32.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-15 08:32:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-15 08:32:55 +0000
commit3343feeebf5f3f7f3219eadab1d93e11b5ba9f6a (patch)
tree2742f395e17e5c6396e0a6860be3390d2d62b704 /thread_win32.c
parent48de9363d230f8b23afe14e5b18d0683858004ae (diff)
Handle machine stack overflow on mingw
* thread_win32.c (rb_w32_stack_overflow_handler): use Structured Exception Handling by Addvectoredexceptionhandler() for machine stack overflow on mingw. This would be equivalent to the handling using __try and __exept on mswin introduced by r43748. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/thread_win32.c b/thread_win32.c
index db00a736f6..feadede50d 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -754,6 +754,18 @@ 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)