To: vim_dev@googlegroups.com Subject: Patch 8.2.4595 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4595 Problem: X11: using --remote-wait may keep the CPU busy. Solution: Set the timeout for select() on every call. (Jacopo Secchiero, closes #9973) Files: src/if_xcmdsrv.c *** ../vim-8.2.4594/src/if_xcmdsrv.c 2022-01-02 21:26:12.315264334 +0000 --- src/if_xcmdsrv.c 2022-03-20 11:02:23.615813325 +0000 *************** *** 556,574 **** #define UI_MSEC_DELAY 53 #define SEND_MSEC_POLL 500 ! #ifndef HAVE_SELECT ! struct pollfd fds; ! ! fds.fd = ConnectionNumber(dpy); ! fds.events = POLLIN; ! #else fd_set fds; - struct timeval tv; - tv.tv_sec = 0; - tv.tv_usec = SEND_MSEC_POLL * 1000; FD_ZERO(&fds); FD_SET(ConnectionNumber(dpy), &fds); #endif time(&start); --- 556,571 ---- #define UI_MSEC_DELAY 53 #define SEND_MSEC_POLL 500 ! #ifdef HAVE_SELECT fd_set fds; FD_ZERO(&fds); FD_SET(ConnectionNumber(dpy), &fds); + #else + struct pollfd fds; + + fds.fd = ConnectionNumber(dpy); + fds.events = POLLIN; #endif time(&start); *************** *** 593,603 **** // Just look out for the answer without calling back into Vim if (localLoop) { ! #ifndef HAVE_SELECT ! if (poll(&fds, 1, SEND_MSEC_POLL) < 0) break; #else ! if (select(FD_SETSIZE, &fds, NULL, NULL, &tv) < 0) break; #endif } --- 590,606 ---- // Just look out for the answer without calling back into Vim if (localLoop) { ! #ifdef HAVE_SELECT ! struct timeval tv; ! ! // Set the time every call, select() may change it to the remaining ! // time. ! tv.tv_sec = 0; ! tv.tv_usec = SEND_MSEC_POLL * 1000; ! if (select(FD_SETSIZE, &fds, NULL, NULL, &tv) < 0) break; #else ! if (poll(&fds, 1, SEND_MSEC_POLL) < 0) break; #endif } *** ../vim-8.2.4594/src/version.c 2022-03-19 12:56:42.533503825 +0000 --- src/version.c 2022-03-20 11:06:47.419744738 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4595, /**/ -- Back up my hard drive? I can't find the reverse switch! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///