forked from aniani/vim
patch 8.0.1170: using termdebug results in 100% CPU time
Problem: Using termdebug results in 100% CPU time. (tomleb) Solution: Use polling instead of select().
This commit is contained in:
@@ -5330,6 +5330,9 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
|
||||
channel = add_channel();
|
||||
if (channel == NULL)
|
||||
goto failed;
|
||||
if (job->jv_tty_out != NULL)
|
||||
ch_log(channel, "using pty %s on fd %d",
|
||||
job->jv_tty_out, pty_master_fd);
|
||||
}
|
||||
|
||||
BLOCK_SIGNALS(&curset);
|
||||
@@ -5702,6 +5705,9 @@ mch_create_pty_channel(job_T *job, jobopt_T *options)
|
||||
close(pty_master_fd);
|
||||
return FAIL;
|
||||
}
|
||||
if (job->jv_tty_out != NULL)
|
||||
ch_log(channel, "using pty %s on fd %d",
|
||||
job->jv_tty_out, pty_master_fd);
|
||||
job->jv_channel = channel; /* ch_refcount was set by add_channel() */
|
||||
channel->ch_keep_open = TRUE;
|
||||
|
||||
@@ -5969,7 +5975,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted)
|
||||
}
|
||||
# endif
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
nfd = channel_poll_setup(nfd, &fds);
|
||||
nfd = channel_poll_setup(nfd, &fds, &towait);
|
||||
#endif
|
||||
if (interrupted != NULL)
|
||||
*interrupted = FALSE;
|
||||
@@ -6021,7 +6027,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted)
|
||||
}
|
||||
# endif
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
if (ret > 0)
|
||||
/* also call when ret == 0, we may be polling a keep-open channel */
|
||||
if (ret >= 0)
|
||||
ret = channel_poll_check(ret, &fds);
|
||||
#endif
|
||||
|
||||
@@ -6097,7 +6104,7 @@ select_eintr:
|
||||
}
|
||||
# endif
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
maxfd = channel_select_setup(maxfd, &rfds, &wfds);
|
||||
maxfd = channel_select_setup(maxfd, &rfds, &wfds, &tv, &tvp);
|
||||
# endif
|
||||
if (interrupted != NULL)
|
||||
*interrupted = FALSE;
|
||||
@@ -6183,7 +6190,8 @@ select_eintr:
|
||||
}
|
||||
# endif
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
if (ret > 0)
|
||||
/* also call when ret == 0, we may be polling a keep-open channel */
|
||||
if (ret >= 0)
|
||||
ret = channel_select_check(ret, &rfds, &wfds);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user