* process.c (rb_waitpid): retries waitpid when EINTR.
[ruby-core:19744]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c7e236efc1
commit
b3ff7eb3ef
@ -1,3 +1,8 @@
|
|||||||
|
Mon Dec 29 22:37:17 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||||
|
|
||||||
|
* process.c (rb_waitpid): retries waitpid when EINTR.
|
||||||
|
[ruby-core:19744].
|
||||||
|
|
||||||
Mon Dec 29 23:18:52 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
Mon Dec 29 23:18:52 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* bignum.c (rb_cstr_to_inum): changed an error message.
|
* bignum.c (rb_cstr_to_inum): changed an error message.
|
||||||
|
@ -624,18 +624,17 @@ rb_waitpid(rb_pid_t pid, int *st, int flags)
|
|||||||
#ifndef NO_WAITPID
|
#ifndef NO_WAITPID
|
||||||
struct waitpid_arg arg;
|
struct waitpid_arg arg;
|
||||||
|
|
||||||
|
retry:
|
||||||
arg.pid = pid;
|
arg.pid = pid;
|
||||||
arg.st = st;
|
arg.st = st;
|
||||||
arg.flags = flags;
|
arg.flags = flags;
|
||||||
result = (rb_pid_t)rb_thread_blocking_region(rb_waitpid_blocking, &arg,
|
result = (rb_pid_t)rb_thread_blocking_region(rb_waitpid_blocking, &arg,
|
||||||
RUBY_UBF_PROCESS, 0);
|
RUBY_UBF_PROCESS, 0);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
#if 0
|
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
rb_thread_polling();
|
RUBY_VM_CHECK_INTS();
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else /* NO_WAITPID */
|
#else /* NO_WAITPID */
|
||||||
|
@ -1044,4 +1044,16 @@ class TestProcess < Test::Unit::TestCase
|
|||||||
def test_pst_inspect
|
def test_pst_inspect
|
||||||
assert_nothing_raised { Process::Status.allocate.inspect }
|
assert_nothing_raised { Process::Status.allocate.inspect }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_wait_and_sigchild
|
||||||
|
signal_received = []
|
||||||
|
Signal.trap(:CHLD) { signal_received << true; puts "child died" }
|
||||||
|
pid = fork { sleep 1; exit }
|
||||||
|
Thread.start { raise }
|
||||||
|
Process.wait pid
|
||||||
|
sleep 2
|
||||||
|
assert_equal [true], signal_received, " [ruby-core:19744]"
|
||||||
|
ensure
|
||||||
|
Signal.trap(:CHLD, 'DEFAULT')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user