ruby-changes:64099
From: Nobuyoshi <ko1@a...>
Date: Fri, 11 Dec 2020 19:42:30 +0900 (JST)
Subject: [ruby-changes:64099] 1728eba48a (master): [DOC] Fixed the RDoc location of Process::Status.wait [ci skip]
https://git.ruby-lang.org/ruby.git/commit/?id=1728eba48a From 1728eba48a163c09c0e2a918c13d5c08961bf9a9 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 11 Dec 2020 19:40:25 +0900 Subject: [DOC] Fixed the RDoc location of Process::Status.wait [ci skip] diff --git a/process.c b/process.c index 1ff203d..d880ca5 100644 --- a/process.c +++ b/process.c @@ -1311,6 +1311,43 @@ waitpid_no_SIGCHLD(struct waitpid_state *w) https://github.com/ruby/ruby/blob/trunk/process.c#L1311 w->errnum = errno; } +VALUE +rb_process_status_wait(rb_pid_t pid, int flags) +{ + // We only enter the scheduler if we are "blocking": + if (!(flags & WNOHANG)) { + VALUE scheduler = rb_scheduler_current(); + if (rb_scheduler_supports_process_wait(scheduler)) { + return rb_scheduler_process_wait(scheduler, pid, flags); + } + } + + COROUTINE_STACK_LOCAL(struct waitpid_state, w); + + waitpid_state_init(w, pid, flags); + w->ec = GET_EC(); + + if (WAITPID_USE_SIGCHLD) { + waitpid_wait(w); + } + else { + waitpid_no_SIGCHLD(w); + } + + if (w->ret > 0) { + if (ruby_nocldwait) { + w->ret = -1; + w->errnum = ECHILD; + } + } + + VALUE status = rb_process_status_new(w->ret, w->status, w->errnum); + + COROUTINE_STACK_FREE(w); + + return status; +} + /* * call-seq: * Process::Status.wait(pid=-1, flags=0) -> Process::Status @@ -1354,42 +1391,6 @@ waitpid_no_SIGCHLD(struct waitpid_state *w) https://github.com/ruby/ruby/blob/trunk/process.c#L1391 * * EXPERIMENTAL FEATURE */ -VALUE -rb_process_status_wait(rb_pid_t pid, int flags) -{ - // We only enter the scheduler if we are "blocking": - if (!(flags & WNOHANG)) { - VALUE scheduler = rb_scheduler_current(); - if (rb_scheduler_supports_process_wait(scheduler)) { - return rb_scheduler_process_wait(scheduler, pid, flags); - } - } - - COROUTINE_STACK_LOCAL(struct waitpid_state, w); - - waitpid_state_init(w, pid, flags); - w->ec = GET_EC(); - - if (WAITPID_USE_SIGCHLD) { - waitpid_wait(w); - } - else { - waitpid_no_SIGCHLD(w); - } - - if (w->ret > 0) { - if (ruby_nocldwait) { - w->ret = -1; - w->errnum = ECHILD; - } - } - - VALUE status = rb_process_status_new(w->ret, w->status, w->errnum); - - COROUTINE_STACK_FREE(w); - - return status; -} VALUE rb_process_status_waitv(int argc, VALUE *argv, VALUE _) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/