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

ruby-changes:53337

From: normal <ko1@a...>
Date: Tue, 6 Nov 2018 07:57:03 +0900 (JST)
Subject: [ruby-changes:53337] normal:r65553 (trunk): thread.c (rb_wait_for_single_fd): no point initializing pollfd.revents

normal	2018-11-06 07:56:57 +0900 (Tue, 06 Nov 2018)

  New Revision: 65553

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

  Log:
    thread.c (rb_wait_for_single_fd): no point initializing pollfd.revents
    
    poll(2) and ppoll(2) implementations need to check and write to
    .revents on the initial scan, anyways.  So any poll/ppoll call
    which returns a positive result can be expected to have an
    initialized .revents value.

  Modified files:
    trunk/thread.c
Index: thread.c
===================================================================
--- thread.c	(revision 65552)
+++ thread.c	(revision 65553)
@@ -4043,12 +4043,10 @@ rb_wait_for_single_fd(int fd, int events https://github.com/ruby/ruby/blob/trunk/thread.c#L4043
     fds[0].fd = fd;
     fds[0].events = (short)events;
     do {
-        fds[0].revents = 0;
         fds[1].fd = rb_sigwait_fd_get(th);
 
         if (fds[1].fd >= 0) {
             fds[1].events = POLLIN;
-            fds[1].revents = 0;
             nfds = 2;
             ubf = ubf_sigwait;
         }
@@ -4072,7 +4070,6 @@ rb_wait_for_single_fd(int fd, int events https://github.com/ruby/ruby/blob/trunk/thread.c#L4070
         if (fds[1].fd >= 0) {
             if (result > 0 && fds[1].revents) {
                 result--;
-                fds[1].revents = 0;
             }
             (void)check_signals_nogvl(th, fds[1].fd);
             rb_sigwait_fd_put(th, fds[1].fd);

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

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