зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
e4600b87b5
Коммит
9eb6861502
16
process.c
16
process.c
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче