comparison src/channel.c @ 10309:88331ee68367 v8.0.0050

commit https://github.com/vim/vim/commit/01688ad545ff0809ddad5c8fa6b149dc5d67312b Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 27 20:00:07 2016 +0200 patch 8.0.0050 Problem: An exiting job is detected with a large latency. Solution: Check for pending job more often. (Ozaki Kiichi) Change the double loop in mch_inchar() into one.
author Christian Brabandt <cb@256bit.org>
date Thu, 27 Oct 2016 20:15:04 +0200
parents c5c15c818bda
children 471b87c3b67d
comparison
equal deleted inserted replaced
10308:c6e8a776a1ed 10309:88331ee68367
4641 if (job->jv_status == JOB_STARTED && job->jv_stoponexit != NULL) 4641 if (job->jv_status == JOB_STARTED && job->jv_stoponexit != NULL)
4642 mch_stop_job(job, job->jv_stoponexit); 4642 mch_stop_job(job, job->jv_stoponexit);
4643 } 4643 }
4644 4644
4645 /* 4645 /*
4646 * Return TRUE when there is any job that might exit, which means 4646 * Return TRUE when there is any job that has an exit callback and might exit,
4647 * job_check_ended() should be called once in a while. 4647 * which means job_check_ended() should be called more often.
4648 */ 4648 */
4649 int 4649 int
4650 has_pending_job(void) 4650 has_pending_job(void)
4651 { 4651 {
4652 job_T *job; 4652 job_T *job;
4653 4653
4654 for (job = first_job; job != NULL; job = job->jv_next) 4654 for (job = first_job; job != NULL; job = job->jv_next)
4655 if (job_still_alive(job)) 4655 /* Only should check if the channel has been closed, if the channel is
4656 * open the job won't exit. */
4657 if (job->jv_status == JOB_STARTED && job->jv_exit_cb != NULL
4658 && (job->jv_channel == NULL
4659 || !channel_still_useful(job->jv_channel)))
4656 return TRUE; 4660 return TRUE;
4657 return FALSE; 4661 return FALSE;
4658 } 4662 }
4659 4663
4660 #define MAX_CHECK_ENDED 8 4664 #define MAX_CHECK_ENDED 8