event: Reintroduce the immediate event queue

Commit @264e0d872c("Remove automatic event deferral") removed the immediate
event queue because event deferral now had to be explicit. The problem is that
while some events don't need to be deferred, they still can result in recursive
`event_poll` calls, and recursion is not supported by libuv. Examples of those
are msgpack-rpc requests while a server->client request is pending, or signals
which can call `mch_exit`(and that will result in `uv_run` calls).

To fix the problem, this reintroduces the immediate event queue for events that
can potentially result in event loop recursion. The non-deferred events are
still processed in `event_poll`, but only after `uv_run` returns.
This commit is contained in:
Thiago de Arruda
2014-11-02 16:37:08 -03:00
parent e378965a44
commit a1dd70b1d0
4 changed files with 54 additions and 33 deletions

View File

@@ -19541,7 +19541,7 @@ char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub, char_u *flags)
event_push((Event) { \
.handler = on_job_event, \
.data = event_data \
}); \
}, true); \
} while(0)
static void on_job_stdout(RStream *rstream, void *data, bool eof)