ruby-changes:51586
From: normal <ko1@a...>
Date: Sat, 30 Jun 2018 15:11:39 +0900 (JST)
Subject: [ruby-changes:51586] normal:r63797 (trunk): process.c: attempt to reap spawnvp (win32) result from mjit
normal 2018-06-30 15:11:33 +0900 (Sat, 30 Jun 2018) New Revision: 63797 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63797 Log: process.c: attempt to reap spawnvp (win32) result from mjit Basically in win32, mjit.c seems to work directly on spawnvp result while normal Ruby code wraps process handles to look like *nix PIDs. I'm only guessing, here... Modified files: trunk/process.c Index: process.c =================================================================== --- process.c (revision 63796) +++ process.c (revision 63797) @@ -923,15 +923,27 @@ waitpid_notify(struct waitpid_state *w, https://github.com/ruby/ruby/blob/trunk/process.c#L923 rb_native_cond_signal(w->cond); } -/* called by both timer thread and main thread */ +#ifdef _WIN32 /* for spawnvp result from mjit.c */ +# define waitpid_sys(pid,status,options) \ + (WaitForSingleObject((HANDLE)(pid), 0),\ + GetExitCodeProcess((HANDLE)(pid), (LPDWORD)(status))) +#else +# define waitpid_sys(pid,status,options) do_waitpid((pid),(status),(options)) +#endif +/* called by timer thread */ static void waitpid_each(struct list_head *head) { struct waitpid_state *w = 0, *next; list_for_each_safe(head, w, next, wnode) { - rb_pid_t ret = do_waitpid(w->pid, &w->status, w->options | WNOHANG); + rb_pid_t ret; + + if (w->ec) + ret = do_waitpid(w->pid, &w->status, w->options | WNOHANG); + else + ret = waitpid_sys(w->pid, &w->status, w->options | WNOHANG); if (!ret) continue; if (ret == -1) w->errnum = errno; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/