aboutsummaryrefslogtreecommitdiffstats
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-10 15:52:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-10 15:52:45 +0000
commita5b9624fdc645b836980e38c6e1109f3584ab43a (patch)
tree98f9bdf9f26f525c1040b9370d331d510d2ae874 /thread_pthread.c
parent3385f6a0d45210c45bcc09871075032d82dc814c (diff)
downloadruby-a5b9624fdc645b836980e38c6e1109f3584ab43a.tar.gz
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 0df64237ce..848051afd1 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1238,7 +1238,8 @@ rb_thread_wakeup_timer_thread_fd(int fd)
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)
#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)
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);
}
}
}