diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-30 21:50:42 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-30 21:50:42 +0000 |
commit | 8a25378aa1c131f81bd57427d4a790970e9c5a5a (patch) | |
tree | d58353b93c94e2714f48e91f5eb79220caebd555 | |
parent | 5b9e8aa75f060da8ca7005c9cdc3c59cc55715e5 (diff) | |
download | ruby-8a25378aa1c131f81bd57427d4a790970e9c5a5a.tar.gz |
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/trunk@60079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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 675a2ddbae..9576cd3ed7 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1318,17 +1318,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 */ |