ruby-changes:35328
From: akr <ko1@a...>
Date: Fri, 5 Sep 2014 20:49:18 +0900 (JST)
Subject: [ruby-changes:35328] akr:r47410 (trunk): * process.c (handle_fork_error): Don't need state_p argument.
akr 2014-09-05 20:49:04 +0900 (Fri, 05 Sep 2014) New Revision: 47410 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47410 Log: * process.c (handle_fork_error): Don't need state_p argument. Modified files: trunk/ChangeLog trunk/process.c Index: ChangeLog =================================================================== --- ChangeLog (revision 47409) +++ ChangeLog (revision 47410) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Sep 5 20:48:06 2014 Tanaka Akira <akr@f...> + + * process.c (handle_fork_error): Don't need state_p argument. + Fri Sep 5 20:35:52 2014 Tanaka Akira <akr@f...> * process.c (has_privilege): Fix a return value. Index: process.c =================================================================== --- process.c (revision 47409) +++ process.c (revision 47410) @@ -3159,8 +3159,10 @@ pipe_nocrash(int filedes[2], VALUE fds) https://github.com/ruby/ruby/blob/trunk/process.c#L3159 #endif static int -handle_fork_error(int *status, int *ep, int *state_p, int *try_gc_p) +handle_fork_error(int *status, int *ep, int *try_gc_p) { + int state = 0; + switch (errno) { case ENOMEM: if ((*try_gc_p)-- > 0 && !rb_during_gc()) { @@ -3177,16 +3179,16 @@ handle_fork_error(int *status, int *ep, https://github.com/ruby/ruby/blob/trunk/process.c#L3179 return 0; } else { - rb_protect((VALUE (*)())rb_thread_sleep, 1, state_p); - if (status) *status = *state_p; - if (!*state_p) return 0; + rb_protect((VALUE (*)())rb_thread_sleep, 1, &state); + if (status) *status = state; + if (!state) return 0; } break; } if (ep) { preserving_errno((close(ep[0]), close(ep[1]))); } - if (*state_p && !status) rb_jump_tag(*state_p); + if (state && !status) rb_jump_tag(state); return -1; } @@ -3388,7 +3390,6 @@ retry_fork_async_signal_safe(int *status https://github.com/ruby/ruby/blob/trunk/process.c#L3390 char *errmsg, size_t errmsg_buflen) { rb_pid_t pid; - int state = 0; int try_gc = 1; while (1) { @@ -3416,7 +3417,7 @@ retry_fork_async_signal_safe(int *status https://github.com/ruby/ruby/blob/trunk/process.c#L3417 if (0 < pid) /* fork succeed, parent process */ return pid; /* fork failed */ - if (handle_fork_error(status, ep, &state, &try_gc)) + if (handle_fork_error(status, ep, &try_gc)) return -1; } } @@ -3458,7 +3459,6 @@ static rb_pid_t https://github.com/ruby/ruby/blob/trunk/process.c#L3459 retry_fork_ruby(int *status) { rb_pid_t pid; - int state = 0; int try_gc = 1; while (1) { @@ -3471,7 +3471,7 @@ retry_fork_ruby(int *status) https://github.com/ruby/ruby/blob/trunk/process.c#L3471 if (0 < pid) /* fork succeed, parent process */ return pid; /* fork failed */ - if (handle_fork_error(status, NULL, &state, &try_gc)) + if (handle_fork_error(status, NULL, &try_gc)) return -1; } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/