From 291a82f748de56e65fac10edefc51ec7a54a82d4 Mon Sep 17 00:00:00 2001 From: normal Date: Sat, 4 Aug 2018 20:38:48 +0000 Subject: [PATCH] thread.c (consume_communication_pipe): do not retry after short read Saves a syscall and slightly improves vm_thread_condvar1 benchmark slightly (more improvements on the way): r64170 this patch vm_thread_condvar1 0.917 1.065 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/thread.c b/thread.c index 161f16365c..9c7fcee05f 100644 --- a/thread.c +++ b/thread.c @@ -4273,6 +4273,9 @@ consume_communication_pipe(int fd) result = read(fd, buff, sizeof(buff)); if (result > 0) { ret = TRUE; + if (result < (ssize_t)sizeof(buff)) { + return ret; + } } else if (result == 0) { return ret;