ruby-changes:47964
From: normal <ko1@a...>
Date: Sun, 1 Oct 2017 06:50:58 +0900 (JST)
Subject: [ruby-changes:47964] normal:r60079 (trunk): thread_pthread.c: do not wakeup inside child processes
normal 2017-10-01 06:50:42 +0900 (Sun, 01 Oct 2017) New Revision: 60079 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60079 Log: thread_pthread.c: do not wakeup inside child processes * thread_pthread.c (rb_thread_wakeup_timer_thread): check ownership before incrementing (rb_thread_wakeup_timer_thread_low): ditto [Bug #13794] [ruby-core:83064] Modified files: trunk/thread_pthread.c Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 60078) +++ thread_pthread.c (revision 60079) @@ -1318,17 +1318,21 @@ void https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1318 rb_thread_wakeup_timer_thread(void) { /* must be safe inside sighandler, so no mutex */ - ATOMIC_INC(timer_thread_pipe.writing); - rb_thread_wakeup_timer_thread_fd(&timer_thread_pipe.normal[1]); - ATOMIC_DEC(timer_thread_pipe.writing); + if (timer_thread_pipe.owner_process == getpid()) { + ATOMIC_INC(timer_thread_pipe.writing); + rb_thread_wakeup_timer_thread_fd(&timer_thread_pipe.normal[1]); + ATOMIC_DEC(timer_thread_pipe.writing); + } } static void rb_thread_wakeup_timer_thread_low(void) { - ATOMIC_INC(timer_thread_pipe.writing); - rb_thread_wakeup_timer_thread_fd(&timer_thread_pipe.low[1]); - ATOMIC_DEC(timer_thread_pipe.writing); + if (timer_thread_pipe.owner_process == getpid()) { + ATOMIC_INC(timer_thread_pipe.writing); + rb_thread_wakeup_timer_thread_fd(&timer_thread_pipe.low[1]); + ATOMIC_DEC(timer_thread_pipe.writing); + } } /* VM-dependent API is not available for this function */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/