diff options
author | Nobuyoshi Nakada <[email protected]> | 2020-12-11 19:40:25 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2020-12-11 19:40:25 +0900 |
commit | 1728eba48a163c09c0e2a918c13d5c08961bf9a9 (patch) | |
tree | de334a077c3851f4e1816d4524808170085d6eca /process.c | |
parent | 885135f84cd609fb1c7be3fa0a20ae77969eae9d (diff) |
[DOC] Fixed the RDoc location of Process::Status.wait [ci skip]
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 73 |
1 files changed, 37 insertions, 36 deletions
@@ -1311,6 +1311,43 @@ waitpid_no_SIGCHLD(struct waitpid_state *w) 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) * * 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 _) |