ruby-changes:46246
From: nobu <ko1@a...>
Date: Sat, 15 Apr 2017 11:07:06 +0900 (JST)
Subject: [ruby-changes:46246] nobu:r58361 (trunk): signal.c: prefer pthread_sigmask
nobu 2017-04-15 11:07:01 +0900 (Sat, 15 Apr 2017) New Revision: 58361 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58361 Log: signal.c: prefer pthread_sigmask * signal.c (raise_stack_overflow): prefer pthread_sigmask to sigprocmask, for multithreading. Modified files: trunk/signal.c Index: signal.c =================================================================== --- signal.c (revision 58360) +++ signal.c (revision 58361) @@ -773,18 +773,24 @@ NORETURN(void ruby_thread_stack_overflow https://github.com/ruby/ruby/blob/trunk/signal.c#L773 # define USE_UCONTEXT_REG 1 # endif NORETURN(static void raise_stack_overflow(int sig, rb_thread_t *th)); +#if defined(HAVE_PTHREAD_SIGMASK) +# define ruby_sigunmask pthread_sigmask +#elif defined(HAVE_SIGPROCMASK) +# define ruby_sigunmask sigprocmask +#endif static void raise_stack_overflow(int sig, rb_thread_t *th) { -#ifdef HAVE_SIGPROCMASK +#if defined(ruby_sigunmask) sigset_t mask; #endif clear_received_signal(); -#ifdef HAVE_SIGPROCMASK +#if defined(ruby_sigunmask) sigemptyset(&mask); sigaddset(&mask, sig); - if (sigprocmask(SIG_UNBLOCK, &mask, NULL)) - rb_bug_errno("sigprocmask:set", errno); + if (ruby_sigunmask(SIG_UNBLOCK, &mask, NULL)) { + rb_bug_errno(STRINGIZE(ruby_sigunmask)":unblock", errno); + } #endif ruby_thread_stack_overflow(th); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/