* 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
This commit is contained in:
parent
27f25728e6
commit
368fdf9cc1
@ -1,3 +1,8 @@
|
|||||||
|
Sun Mar 3 02:42:29 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* thread_pthread.c (consume_communication_pipe): retry when
|
||||||
|
read returned CCP_READ_BUFF_SIZE.
|
||||||
|
|
||||||
Wed Mar 6 21:31:35 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Wed Mar 6 21:31:35 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* thread_pthread.c (timer_thread_sleep): use poll() instead of
|
* thread_pthread.c (timer_thread_sleep): use poll() instead of
|
||||||
|
@ -1186,13 +1186,20 @@ consume_communication_pipe(void)
|
|||||||
static char buff[CCP_READ_BUFF_SIZE];
|
static char buff[CCP_READ_BUFF_SIZE];
|
||||||
ssize_t result;
|
ssize_t result;
|
||||||
|
|
||||||
retry:
|
while (1) {
|
||||||
result = read(timer_thread_pipe[0], buff, CCP_READ_BUFF_SIZE);
|
result = read(timer_thread_pipe[0], buff, sizeof(buff));
|
||||||
if (result < 0) {
|
if (result == 0) {
|
||||||
switch (errno) {
|
return;
|
||||||
case EINTR: goto retry;
|
}
|
||||||
default:
|
else if (result < 0) {
|
||||||
rb_async_bug_errno("consume_communication_pipe: read\n", errno);
|
switch (errno) {
|
||||||
|
case EINTR:
|
||||||
|
continue; /* retry */
|
||||||
|
case EAGAIN:
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
rb_async_bug_errno("consume_communication_pipe: read\n", errno);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user