comparison src/os_unix.c @ 3470:4a2cb025b641 v7.3.499

updated for version 7.3.499 Problem: When using any interface language when Vim is waiting for a child process it gets confused by a child process started through the interface. Solution: Always used waitpid() instead of wait(). (Yasuhiro Matsumoto)
author Bram Moolenaar <bram@vim.org>
date Fri, 20 Apr 2012 15:55:16 +0200
parents 81201fb337a5
children 44038a9777aa
comparison
equal deleted inserted replaced
3469:67d75c778226 3470:4a2cb025b641
3732 { 3732 {
3733 pid_t wait_pid = 0; 3733 pid_t wait_pid = 0;
3734 3734
3735 while (wait_pid != child) 3735 while (wait_pid != child)
3736 { 3736 {
3737 # ifdef _THREAD_SAFE 3737 /* When compiled with Python threads are probably used, in which case
3738 /* Ugly hack: when compiled with Python threads are probably 3738 * wait() sometimes hangs for no obvious reason. Use waitpid()
3739 * used, in which case wait() sometimes hangs for no obvious 3739 * instead and loop (like the GUI). Also needed for other interfaces,
3740 * reason. Use waitpid() instead and loop (like the GUI). */ 3740 * they might call system(). */
3741 # ifdef __NeXT__ 3741 # ifdef __NeXT__
3742 wait_pid = wait4(child, status, WNOHANG, (struct rusage *)0); 3742 wait_pid = wait4(child, status, WNOHANG, (struct rusage *)0);
3743 # else 3743 # else
3744 wait_pid = waitpid(child, status, WNOHANG); 3744 wait_pid = waitpid(child, status, WNOHANG);
3745 # endif 3745 # endif
3746 if (wait_pid == 0) 3746 if (wait_pid == 0)
3747 { 3747 {
3748 /* Wait for 1/100 sec before trying again. */ 3748 /* Wait for 1/100 sec before trying again. */
3749 mch_delay(10L, TRUE); 3749 mch_delay(10L, TRUE);
3750 continue; 3750 continue;
3751 } 3751 }
3752 # else
3753 wait_pid = wait(status);
3754 # endif
3755 if (wait_pid <= 0 3752 if (wait_pid <= 0
3756 # ifdef ECHILD 3753 # ifdef ECHILD
3757 && errno == ECHILD 3754 && errno == ECHILD
3758 # endif 3755 # endif
3759 ) 3756 )