mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 19:06:31 +00:00
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.
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user