From 341c1cb7f8917838da788ef35dab6a65bce55cff Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 21 Jun 2009 09:16:58 +0000 Subject: merges r23720 from trunk into ruby_1_9_1. -- * thread.c (ruby_thread_stack_overflow): call rb_exc_raise() on stack overflows in the signal handler, if sigaltstack is available. On stack overflow (and with sigaltstack), the signal handler is more likely to have room to create an exception object. [ruby-core:23813] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'thread.c') diff --git a/thread.c b/thread.c index fce974acf4..91b957681d 100644 --- a/thread.c +++ b/thread.c @@ -1302,12 +1302,21 @@ rb_thread_signal_exit(void *thptr) rb_thread_raise(2, argv, th->vm->main_thread); } +#if defined(POSIX_SIGNAL) && defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) +#define USE_SIGALTSTACK +#endif + void ruby_thread_stack_overflow(rb_thread_t *th) { - th->errinfo = sysstack_error; th->raised_flag = 0; +#ifdef USE_SIGALTSTACK + th->raised_flag = 0; + rb_exc_raise(sysstack_error); +#else + th->errinfo = sysstack_error; TH_JUMP_TAG(th, TAG_RAISE); +#endif } int -- cgit v1.2.3