diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-30 06:11:33 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-30 06:11:33 +0000 |
commit | 9fb3b8a677b889bdff290e4636a6fd5362ed0834 (patch) | |
tree | 9371d00c38d068a883c432e01a000d33e9315f20 /process.c | |
parent | 7b4dfe5b77fb0dbe231aab8b128dbf5f951db97e (diff) | |
download | ruby-9fb3b8a677b889bdff290e4636a6fd5362ed0834.tar.gz |
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...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -923,15 +923,27 @@ waitpid_notify(struct waitpid_state *w, rb_pid_t ret) 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; |