ruby-changes:52239
From: naruse <ko1@a...>
Date: Sat, 18 Aug 2018 21:35:35 +0900 (JST)
Subject: [ruby-changes:52239] naruse:r64447 (trunk): Temporary revert "process.c: dead code when no SIGCHLD"
naruse 2018-08-18 21:35:28 +0900 (Sat, 18 Aug 2018) New Revision: 64447 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64447 Log: Temporary revert "process.c: dead code when no SIGCHLD" This reverts commit r64407. Maybe it breaks http://mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-trunk/log/20180817T095734Z.fail.html.gz Modified files: trunk/process.c trunk/signal.c Index: process.c =================================================================== --- process.c (revision 64446) +++ process.c (revision 64447) @@ -981,7 +981,6 @@ rb_sigwait_fd_migrate(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/process.c#L981 rb_native_mutex_unlock(&vm->waitpid_lock); } -#if RUBY_SIGCHLD static void waitpid_notify(struct waitpid_state *w, rb_pid_t ret) { @@ -995,7 +994,13 @@ waitpid_notify(struct waitpid_state *w, https://github.com/ruby/ruby/blob/trunk/process.c#L994 } } +#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 extern volatile unsigned int ruby_nocldwait; /* signal.c */ /* called by timer thread or thread which acquired sigwait_fd */ @@ -1027,14 +1032,10 @@ waitpid_each(struct list_head *head) https://github.com/ruby/ruby/blob/trunk/process.c#L1032 } } } -#else -# define ruby_nocldwait 0 -#endif void ruby_waitpid_all(rb_vm_t *vm) { -#if RUBY_SIGCHLD rb_native_mutex_lock(&vm->waitpid_lock); waitpid_each(&vm->waiting_pids); if (list_empty(&vm->waiting_pids)) { @@ -1046,7 +1047,6 @@ ruby_waitpid_all(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/process.c#L1047 ; /* keep looping */ } rb_native_mutex_unlock(&vm->waitpid_lock); -#endif } static void @@ -4458,27 +4458,21 @@ rb_f_system(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L4458 execarg_obj = rb_execarg_new(argc, argv, TRUE, TRUE); TypedData_Get_Struct(execarg_obj, struct rb_execarg, &exec_arg_data_type, eargp); -#if RUBY_SIGCHLD eargp->nocldwait_prev = ruby_nocldwait; ruby_nocldwait = 0; -#endif pid = rb_execarg_spawn(execarg_obj, NULL, 0); #if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV) if (pid > 0) { int ret, status; ret = rb_waitpid(pid, &status, 0); if (ret == (rb_pid_t)-1) { -# if RUBY_SIGCHLD ruby_nocldwait = eargp->nocldwait_prev; -# endif RB_GC_GUARD(execarg_obj); rb_sys_fail("Another thread waited the process started by system()."); } } #endif -#if RUBY_SIGCHLD ruby_nocldwait = eargp->nocldwait_prev; -#endif if (pid < 0) { if (eargp->exception) { int err = errno; Index: signal.c =================================================================== --- signal.c (revision 64446) +++ signal.c (revision 64447) @@ -531,9 +531,7 @@ static struct { https://github.com/ruby/ruby/blob/trunk/signal.c#L531 rb_atomic_t cnt[RUBY_NSIG]; rb_atomic_t size; } signal_buff; -#if RUBY_SIGCHLD volatile unsigned int ruby_nocldwait; -#endif #ifdef __dietlibc__ #define sighandler_t sh_t @@ -617,8 +615,7 @@ ruby_signal(int signum, sighandler_t han https://github.com/ruby/ruby/blob/trunk/signal.c#L615 #endif switch (signum) { -#if RUBY_SIGCHLD - case RUBY_SIGCHLD: + case SIGCHLD: if (handler == SIG_IGN) { ruby_nocldwait = 1; if (sigact.sa_flags & SA_SIGINFO) { @@ -632,7 +629,6 @@ ruby_signal(int signum, sighandler_t han https://github.com/ruby/ruby/blob/trunk/signal.c#L629 ruby_nocldwait = 0; } break; -#endif #if defined(SA_ONSTACK) && defined(USE_SIGALTSTACK) case SIGSEGV: #ifdef SIGBUS -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/