From aed702fb46dd91d249eac8899bd7adff30602dca Mon Sep 17 00:00:00 2001 From: ichizok Date: Tue, 15 May 2018 17:33:56 +0900 Subject: [PATCH] Fix a wait for channel I/O --- src/MacVim/MMBackend.m | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index ca7f750701..c56225a5f0 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -703,24 +703,14 @@ extern GuiFont gui_mch_retain_font(GuiFont font); forMode:NSDefaultRunLoopMode]; } - CFAbsoluteTime lastTime = - milliseconds >= 0 ? CFAbsoluteTimeGetCurrent() : .0; - while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, dt, true) == kCFRunLoopRunHandledSource) { - // In order to ensure that all input (except for channel) on the - // run-loop has been processed we set the timeout to 0 and keep - // processing until the run-loop times out. - if ([inputQueue count] > 0 || input_available() || got_int) { - dt = 0.0; + // In order to ensure that all input on the run-loop has been + // processed we set the timeout to 0 and keep processing until the + // run-loop times out. + dt = 0.0; + if ([inputQueue count] > 0 || input_available() || got_int) inputReceived = YES; - } else if (milliseconds >= 0) { - CFAbsoluteTime nowTime = CFAbsoluteTimeGetCurrent(); - - if ((dt -= nowTime - lastTime) <= 0.0) - break; - lastTime = nowTime; - } } if ([inputQueue count] > 0 || input_available() || got_int)