diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-10 03:59:39 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-10 03:59:39 +0000 |
commit | 368fdf9cc164caef3ea08cdd9226542de943479f (patch) | |
tree | 03b0747e9679d0051a429975b2e75f3b2cfa7905 | |
parent | 27f25728e69274fd226007bd6765d3819b0449c7 (diff) |
* thread_pthread.c (consume_communication_pipe): retry when
read returned CCP_READ_BUFF_SIZE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | thread_pthread.c | 21 |
2 files changed, 19 insertions, 7 deletions
@@ -1,3 +1,8 @@ +Sun Mar 3 02:42:29 2013 KOSAKI Motohiro <[email protected]> + + * thread_pthread.c (consume_communication_pipe): retry when + read returned CCP_READ_BUFF_SIZE. + Wed Mar 6 21:31:35 2013 KOSAKI Motohiro <[email protected]> * thread_pthread.c (timer_thread_sleep): use poll() instead of diff --git a/thread_pthread.c b/thread_pthread.c index cd0aef7095..4ae7e2abe4 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1186,13 +1186,20 @@ consume_communication_pipe(void) static char buff[CCP_READ_BUFF_SIZE]; ssize_t result; - retry: - result = read(timer_thread_pipe[0], buff, CCP_READ_BUFF_SIZE); - if (result < 0) { - switch (errno) { - case EINTR: goto retry; - default: - rb_async_bug_errno("consume_communication_pipe: read\n", errno); + while (1) { + result = read(timer_thread_pipe[0], buff, sizeof(buff)); + if (result == 0) { + return; + } + else if (result < 0) { + switch (errno) { + case EINTR: + continue; /* retry */ + case EAGAIN: + return; + default: + rb_async_bug_errno("consume_communication_pipe: read\n", errno); + } } } } |