diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-03 09:56:38 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-03 09:56:38 +0000 |
commit | ed0f2528e86fd993ab740db4d5b34d3c24f73b34 (patch) | |
tree | e4cbeadf0663eaaecedec3dc117e5525f88e5ee5 | |
parent | b46b1e3f5a7ec5d72b9597f387e0eee802d4ab63 (diff) | |
download | ruby-ed0f2528e86fd993ab740db4d5b34d3c24f73b34.tar.gz |
* process.c (forked_child): Removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | process.c | 31 |
2 files changed, 15 insertions, 20 deletions
@@ -1,3 +1,7 @@ +Wed Sep 3 18:56:05 2014 Tanaka Akira <akr@fsij.org> + + * process.c (forked_child): Removed. + Wed Sep 3 16:56:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> * object.c (rb_obj_copy_ivar): allocate no memory for empty @@ -1094,8 +1094,6 @@ proc_detach(VALUE obj, VALUE pid) return rb_detach_process(NUM2PIDT(pid)); } -static int forked_child = 0; - #ifdef SIGPIPE static RETSIGTYPE (*saved_sigpipe_handler)(int) = 0; #endif @@ -1123,22 +1121,20 @@ before_exec_async_signal_safe(void) } static void -before_exec_non_async_signal_safe(void) +before_exec_non_async_signal_safe() { - if (!forked_child) { - /* - * On Mac OS X 10.5.x (Leopard) or earlier, exec() may return ENOTSUP - * if the process have multiple threads. Therefore we have to kill - * internal threads temporary. [ruby-core:10583] - * This is also true on Haiku. It returns Errno::EPERM against exec() - * in multiple threads. - */ - rb_thread_stop_timer_thread(0); - } + /* + * On Mac OS X 10.5.x (Leopard) or earlier, exec() may return ENOTSUP + * if the process have multiple threads. Therefore we have to kill + * internal threads temporary. [ruby-core:10583] + * This is also true on Haiku. It returns Errno::EPERM against exec() + * in multiple threads. + */ + rb_thread_stop_timer_thread(0); } static void -before_exec(void) +before_exec() { before_exec_non_async_signal_safe(); before_exec_async_signal_safe(); @@ -1158,8 +1154,6 @@ after_exec_non_async_signal_safe(void) { rb_thread_reset_timer_thread(); rb_thread_start_timer_thread(); - - forked_child = 0; } static void @@ -3087,7 +3081,7 @@ static int rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen) { int ret; - before_exec_non_async_signal_safe(); /* async-signal-safe if forked_child is true */ + before_exec_non_async_signal_safe(); /* not async-signal-safe because it calls rb_thread_stop_timer_thread. */ ret = rb_exec_async_signal_safe(eargp, errmsg, errmsg_buflen); /* hopefully async-signal-safe */ preserving_errno(after_exec_non_async_signal_safe()); /* not async-signal-safe because it calls rb_thread_start_timer_thread. */ return ret; @@ -3301,7 +3295,6 @@ retry_fork_async_signal_safe(int *status, int *ep, #endif if (pid == 0) {/* fork succeed, child process */ int ret; - forked_child = 1; close(ep[0]); ret = chfunc(charg, errmsg, errmsg_buflen); if (!ret) _exit(EXIT_SUCCESS); @@ -3312,7 +3305,6 @@ retry_fork_async_signal_safe(int *status, int *ep, _exit(127); #endif } - forked_child = 0; /* for vfork(). */ if (0 < pid) /* fork succeed, parent process */ return pid; /* fork failed */ @@ -3387,7 +3379,6 @@ rb_fork_ruby(int *status) if (pid < 0) return pid; if (!pid) { - forked_child = 1; after_fork(); } return pid; |