summaryrefslogtreecommitdiffstats
path: root/process.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-16 10:26:06 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-16 10:26:06 +0000
commit8ed72d63b780041486b2c1e93d0e6a52ac642bd1 (patch)
tree68a4f98a18aa37572be7a4af17457a082061661b /process.c
parent4815e27c7a3b1de095be1a74657d6cf1ba434862 (diff)
merges r20726 from trunk into ruby_1_9_1.
* process.c (forked_child): new variable. (before_exec): don't call rb_thread_stop_timer_thread if forked_child. (after_exec): reset forked_child after rb_thread_start_timer_thread. (rb_fork): set forked_child just after fork in child. * ext/pty/pty.c (chfunc): extracted from establishShell. (establishShell): use rb_fork. [ruby-dev:37418] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/process.c b/process.c
index 517b4867b..8b8ed17d8 100644
--- a/process.c
+++ b/process.c
@@ -971,10 +971,12 @@ void rb_thread_stop_timer_thread(void);
void rb_thread_start_timer_thread(void);
void rb_thread_reset_timer_thread(void);
+static int forked_child = 0;
+
#define before_exec() \
- (rb_enable_interrupt(), rb_thread_stop_timer_thread())
+ (rb_enable_interrupt(), forked_child ? 0 : rb_thread_stop_timer_thread())
#define after_exec() \
- (rb_thread_start_timer_thread(), rb_disable_interrupt())
+ (rb_thread_start_timer_thread(), forked_child = 0, rb_disable_interrupt())
#define before_fork() before_exec()
#define after_fork() after_exec()
@@ -2301,6 +2303,7 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg, VALUE fds)
}
}
if (!pid) {
+ forked_child = 1;
if (chfunc) {
#ifdef FD_CLOEXEC
close(ep[0]);