ruby-changes:33828
From: nobu <ko1@a...>
Date: Sun, 11 May 2014 00:52:58 +0900 (JST)
Subject: [ruby-changes:33828] nobu:r45909 (trunk): thread_pthread.c: variable for errno
nobu 2014-05-11 00:52:45 +0900 (Sun, 11 May 2014) New Revision: 45909 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45909 Log: thread_pthread.c: variable for errno * thread_pthread.c (rb_thread_wakeup_timer_thread_fd): use a local variable for errno. * thread_pthread.c (consume_communication_pipe): ditto. add EWOULDBLOCK case. Modified files: trunk/thread_pthread.c Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 45908) +++ thread_pthread.c (revision 45909) @@ -1238,7 +1238,8 @@ rb_thread_wakeup_timer_thread_fd(int fd) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1238 const char *buff = "!"; retry: if ((result = write(fd, buff, 1)) <= 0) { - switch (errno) { + int e = errno; + switch (e) { case EINTR: goto retry; case EAGAIN: #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN @@ -1246,7 +1247,7 @@ rb_thread_wakeup_timer_thread_fd(int fd) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1247 #endif break; default: - rb_async_bug_errno("rb_thread_wakeup_timer_thread - write", errno); + rb_async_bug_errno("rb_thread_wakeup_timer_thread - write", e); } } if (TT_DEBUG) WRITE_CONST(2, "rb_thread_wakeup_timer_thread: write\n"); @@ -1283,13 +1284,17 @@ consume_communication_pipe(int fd) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1284 return; } else if (result < 0) { - switch (errno) { - case EINTR: + int e = errno; + switch (e) { + case EINTR: continue; /* retry */ - case EAGAIN: + case EAGAIN: +#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN + case EWOULDBLOCK: +#endif return; - default: - rb_async_bug_errno("consume_communication_pipe: read\n", errno); + default: + rb_async_bug_errno("consume_communication_pipe: read\n", e); } } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/