mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
3385f6a0d4
commit
a5b9624fdc
1 changed files with 12 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue