aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/msgpack_rpc/channel.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-10-20 10:39:54 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-10-21 11:05:49 -0300
commitb527ac752fd5ebcc74c06306e7009e2b98e4ee01 (patch)
tree0785b3f76cb371967ad0b28446611d1a1af60a96 /src/nvim/msgpack_rpc/channel.c
parent264e0d872c598062be2b2a118d38c89a6ed5a023 (diff)
downloadrneovim-b527ac752fd5ebcc74c06306e7009e2b98e4ee01.tar.gz
rneovim-b527ac752fd5ebcc74c06306e7009e2b98e4ee01.tar.bz2
rneovim-b527ac752fd5ebcc74c06306e7009e2b98e4ee01.zip
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.
Diffstat (limited to 'src/nvim/msgpack_rpc/channel.c')
-rw-r--r--src/nvim/msgpack_rpc/channel.c6
1 files changed, 1 insertions, 5 deletions
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) {