To: vim-dev@vim.org Subject: Patch 6.1.428 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.428 Problem: FreeBSD: wait() may hang when compiled with Python support and doing a system() call in a startup script. Solution: Use waitpid() instead of wait() and poll every 10 msec, just like what is done in the GUI. Files: src/os_unix.c *** ../vim61.427/src/os_unix.c Sun Mar 9 15:23:05 2003 --- src/os_unix.c Mon Mar 31 20:41:24 2003 *************** *** 3712,3718 **** --- 3712,3735 ---- */ while (wait_pid != pid) { + #ifdef _THREAD_SAFE + /* Ugly hack: when compiled with Python threads are probably + * used, in which case wait() sometimes hangs for no obvious + * reason. Use waitpid() instead and loop (like the GUI). */ + # ifdef __NeXT__ + wait_pid = wait4(pid, &status, WNOHANG, (struct rusage *)0); + # else + wait_pid = waitpid(pid, &status, WNOHANG); + # endif + if (wait_pid == 0) + { + /* Wait for 1/100 sec before trying again. */ + mch_delay(10L, TRUE); + continue; + } + #else wait_pid = wait(&status); + #endif if (wait_pid <= 0 # ifdef ECHILD && errno == ECHILD *** ../vim61.427/src/version.c Mon Mar 31 20:26:34 2003 --- src/version.c Mon Mar 31 20:42:34 2003 *************** *** 613,614 **** --- 613,616 ---- { /* Add new patch number below this line */ + /**/ + 428, /**/ -- Bravely bold Sir Robin, rode forth from Camelot, He was not afraid to die, Oh Brave Sir Robin, He was not at all afraid to be killed in nasty ways Brave, brave, brave, brave Sir Robin. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///