diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-31 13:49:13 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-31 13:49:13 +0000 |
commit | c5a99cf3c0d493e911f499fdecdd0db68019af98 (patch) | |
tree | cc425c4cd02a8530ae392f92779576e934b94db5 /thread_pthread.c | |
parent | cce645e6a7b1819922c3e9fa2c5bff0bc6d5dfa5 (diff) |
merge revision(s) 60079: [Backport #13794]
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]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/thread_pthread.c b/thread_pthread.c index 9b58cd7050..58648975c9 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1313,17 +1313,21 @@ void 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 */ |