summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-30 09:22:21 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-30 09:22:21 +0000
commitd22b7e6ddbd5c616d90c82cb86fd5797cd2d5a61 (patch)
tree88ef4c2a3b07e3afa215d7b2317c2c97acaa8e2a /process.c
parent303d9d972abfd73e5738d3e7eeb142b9689f0eb6 (diff)
merges r20346 from trunk into ruby_1_9_1.
* process.c (rb_fork): stops the timer thread during fork. [ruby-dev:37117] * thread.c (rb_thread_start_timer_thread): timer thread needs system_working to be set. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/process.c b/process.c
index e54e174f28..517b4867b1 100644
--- a/process.c
+++ b/process.c
@@ -975,6 +975,8 @@ void rb_thread_reset_timer_thread(void);
(rb_enable_interrupt(), rb_thread_stop_timer_thread())
#define after_exec() \
(rb_thread_start_timer_thread(), rb_disable_interrupt())
+#define before_fork() before_exec()
+#define after_fork() after_exec()
#include "dln.h"
@@ -2272,7 +2274,8 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg, VALUE fds)
}
}
#endif
- for (; (pid = fork()) < 0; prefork()) {
+ for (; before_fork(), (pid = fork()) < 0; prefork()) {
+ after_fork();
switch (errno) {
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
@@ -2298,7 +2301,6 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg, VALUE fds)
}
}
if (!pid) {
- rb_thread_reset_timer_thread();
if (chfunc) {
#ifdef FD_CLOEXEC
close(ep[0]);
@@ -2314,10 +2316,10 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg, VALUE fds)
_exit(127);
#endif
}
- rb_thread_start_timer_thread();
}
+ after_fork();
#ifdef FD_CLOEXEC
- else if (chfunc) {
+ if (pid && chfunc) {
close(ep[1]);
if ((state = read(ep[0], &err, sizeof(err))) < 0) {
err = errno;