To: vim_dev@googlegroups.com Subject: Patch 7.4.1667 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1667 Problem: Win32: waiting on a pipe with fixed sleep time. Solution: Start with a short delay and increase it when looping. Files: src/channel.c *** ../vim-7.4.1666/src/channel.c 2016-03-28 14:11:36.854303544 +0200 --- src/channel.c 2016-03-28 14:18:55.837805690 +0200 *************** *** 2371,2378 **** if (fd != channel->CH_SOCK_FD) { DWORD nread; ! int diff; DWORD deadline = GetTickCount() + timeout; /* reading from a pipe, not a socket */ while (TRUE) --- 2371,2379 ---- if (fd != channel->CH_SOCK_FD) { DWORD nread; ! int sleep_time; DWORD deadline = GetTickCount() + timeout; + int delay = 1; /* reading from a pipe, not a socket */ while (TRUE) *************** *** 2380,2391 **** if (PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nread, NULL) && nread > 0) return OK; ! diff = deadline - GetTickCount(); ! if (diff <= 0) break; ! /* Wait for 5 msec. ! * TODO: increase the sleep time when looping more often */ ! Sleep(5); } } else --- 2381,2397 ---- if (PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nread, NULL) && nread > 0) return OK; ! sleep_time = deadline - GetTickCount(); ! if (sleep_time <= 0) break; ! /* Wait for a little while. Very short at first, up to 10 msec ! * after looping a few times. */ ! if (sleep_time > delay) ! sleep_time = delay; ! Sleep(sleep_time); ! delay = delay * 2; ! if (delay > 10) ! delay = 10; } } else *** ../vim-7.4.1666/src/version.c 2016-03-28 14:11:36.858303502 +0200 --- src/version.c 2016-03-28 14:19:46.157290346 +0200 *************** *** 750,751 **** --- 750,753 ---- { /* Add new patch number below this line */ + /**/ + 1667, /**/ -- hundred-and-one symptoms of being an internet addict: 144. You eagerly await the update of the "Cool Site of the Day." /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///