mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 23:38:17 +00:00
event loop: New abstraction layer with refactored time/signal API
- Add event loop abstraction module under src/nvim/event. The src/nvim/event/loop module replaces src/nvim/os/event - Remove direct dependency on libuv signal/timer API and use the new abstraction instead. - Replace all references to uv_default_loop() by &loop.uv, a new global variable that wraps libuv main event loop but allows the event loop functions to be reused in other contexts.
This commit is contained in:
@@ -91,8 +91,8 @@
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/api/vim.h"
|
||||
#include "nvim/os/dl.h"
|
||||
#include "nvim/os/event.h"
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/event/loop.h"
|
||||
|
||||
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
|
||||
|
||||
@@ -10966,7 +10966,7 @@ static void f_jobwait(typval_T *argvars, typval_T *rettv)
|
||||
if (!disable_job_defer++) {
|
||||
// process any pending job events in the deferred queue, but only do this if
|
||||
// deferred is not disabled(at the top-level `jobwait()` call)
|
||||
event_process();
|
||||
loop_process_event(&loop);
|
||||
}
|
||||
// For each item in the input list append an integer to the output list. -3
|
||||
// is used to represent an invalid job id, -2 is for a interrupted job and
|
||||
@@ -11026,7 +11026,7 @@ static void f_jobwait(typval_T *argvars, typval_T *rettv)
|
||||
}
|
||||
|
||||
// poll to ensure any pending callbacks from the last job are invoked
|
||||
event_poll(0);
|
||||
loop_poll_events(&loop, 0);
|
||||
|
||||
for (listitem_T *arg = args->lv_first; arg != NULL; arg = arg->li_next) {
|
||||
Job *job = NULL;
|
||||
@@ -20347,7 +20347,7 @@ static inline void push_job_event(Job *job, ufunc_T *callback,
|
||||
event_data->data = job_data(job);
|
||||
event_data->callback = callback;
|
||||
event_data->type = type;
|
||||
event_push((Event) {
|
||||
loop_push_event(&loop, (Event) {
|
||||
.handler = on_job_event,
|
||||
.data = event_data
|
||||
}, !disable_job_defer);
|
||||
|
Reference in New Issue
Block a user