diff options
author | Samuel Williams <[email protected]> | 2021-06-26 10:17:26 +1200 |
---|---|---|
committer | Samuel Williams <[email protected]> | 2021-07-01 11:23:03 +1200 |
commit | 42130a64f02294dc8025af3a51bda518c67ab33d (patch) | |
tree | e81c181770e4cc9d3e87e960a25a870e9a4774f5 /process.c | |
parent | 9c9531950c007872d7726f050a1dc0cb6f8f0490 (diff) |
Replace copy coroutine with pthread implementation.
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 24 |
1 files changed, 10 insertions, 14 deletions
@@ -14,7 +14,6 @@ #include "ruby/internal/config.h" #include "ruby/fiber/scheduler.h" -#include "coroutine/Stack.h" #include <ctype.h> #include <errno.h> @@ -1350,29 +1349,26 @@ rb_process_status_wait(rb_pid_t pid, int flags) if (result != Qundef) return result; } - COROUTINE_STACK_LOCAL(struct waitpid_state, w); + struct waitpid_state waitpid_state; - waitpid_state_init(w, pid, flags); - w->ec = GET_EC(); + waitpid_state_init(&waitpid_state, pid, flags); + waitpid_state.ec = GET_EC(); if (WAITPID_USE_SIGCHLD) { - waitpid_wait(w); + waitpid_wait(&waitpid_state); } else { - waitpid_no_SIGCHLD(w); + waitpid_no_SIGCHLD(&waitpid_state); } - rb_pid_t ret = w->ret; - int s = w->status, e = w->errnum; - COROUTINE_STACK_FREE(w); + if (waitpid_state.ret == 0) return Qnil; - if (ret == 0) return Qnil; - if (ret > 0 && ruby_nocldwait) { - ret = -1; - e = ECHILD; + if (waitpid_state.ret > 0 && ruby_nocldwait) { + waitpid_state.ret = -1; + waitpid_state.errnum = ECHILD; } - return rb_process_status_new(ret, s, e); + return rb_process_status_new(waitpid_state.ret, waitpid_state.status, waitpid_state.errnum); } /* |