From b527ac752fd5ebcc74c06306e7009e2b98e4ee01 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Mon, 20 Oct 2014 10:39:54 -0300 Subject: event: Extract event_poll loops to `event_poll_until` macro A pattern that is becoming common across the project is to poll for events until a certain condition is true, optionally passing a timeout. To address this scenario, the event_poll_until macro was created and the job/channel/input modules were refactored to use it on their blocking functions. --- src/nvim/msgpack_rpc/channel.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/nvim/msgpack_rpc/channel.c') diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index d31e404c23..91c26ca21e 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -203,11 +203,7 @@ Object channel_send_call(uint64_t id, // Push the frame ChannelCallFrame frame = {request_id, false, false, NIL}; kv_push(ChannelCallFrame *, channel->call_stack, &frame); - - do { - event_poll(-1); - } while (!frame.returned); - + event_poll_until(-1, frame.returned); (void)kv_pop(channel->call_stack); if (frame.errored) { -- cgit