summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 03:58:37 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 03:58:37 +0000
commitcbf33c59ded17f32783954a2226df63af9089504 (patch)
tree9351c61407b8f9ea61bbf99e9d55c8b82f3c4dd7 /io.c
parentab5865409e9a0392e990e0cda681aef3f8585da0 (diff)
merge revision(s) 26371,26373,26374,26972:
* eval.c (thread_timer, rb_thread_stop_timer): check the timing of stopping timer. patch from KOSAKI Motohiro <kosaki.motohiro _AT_ jp.fujitsu.com> * eval.c (rb_thread_start_timer): NetBSD5 seems to be hung when calling pthread_create() from pthread_atfork()'s parent handler. * io.c (pipe_open): workaround for NetBSD5. stop timer thread before fork(), and start it if needed. * process.c (rb_f_fork, rb_f_system): ditto. fixed [ruby-dev:40074] jp.fujitsu.com> via IRC. fork(), and restart it after fork() on parent, and on child if needed. these changes are tested by naruse. fixed [ruby-dev:40074] * io.c, eval.c, process.c: add linux to r26371's condition. patched by Motohiro KOSAKI [ruby-core:28151] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@28203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/io.c b/io.c
index d46d276a1a..4a435b27c5 100644
--- a/io.c
+++ b/io.c
@@ -3251,6 +3251,9 @@ retry:
}
retry:
+#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
+ rb_thread_stop_timer();
+#endif
switch ((pid = fork())) {
case 0: /* child */
if (modef & FMODE_READABLE) {
@@ -3278,11 +3281,17 @@ retry:
ruby_sourcefile, ruby_sourceline, pname);
_exit(127);
}
+#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
+ rb_thread_start_timer();
+#endif
rb_io_synchronized(RFILE(orig_stdout)->fptr);
rb_io_synchronized(RFILE(orig_stderr)->fptr);
return Qnil;
case -1: /* fork failed */
+#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
+ rb_thread_start_timer();
+#endif
if (errno == EAGAIN) {
rb_thread_sleep(1);
goto retry;
@@ -3303,6 +3312,9 @@ retry:
break;
default: /* parent */
+#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
+ rb_thread_start_timer();
+#endif
if (pid < 0) rb_sys_fail(pname);
else {
VALUE port = io_alloc(rb_cIO);