[前][次][番号順一覧][スレッド一覧]

ruby-changes:51970

From: normal <ko1@a...>
Date: Sun, 5 Aug 2018 05:38:52 +0900 (JST)
Subject: [ruby-changes:51970] normal:r64185 (trunk): thread.c (consume_communication_pipe): do not retry after short read

normal	2018-08-05 05:38:48 +0900 (Sun, 05 Aug 2018)

  New Revision: 64185

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64185

  Log:
    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

  Modified files:
    trunk/thread.c
Index: thread.c
===================================================================
--- thread.c	(revision 64184)
+++ thread.c	(revision 64185)
@@ -4273,6 +4273,9 @@ consume_communication_pipe(int fd) https://github.com/ruby/ruby/blob/trunk/thread.c#L4273
 	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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]