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:
Thiago de Arruda
2015-07-16 23:10:04 -03:00
parent 9e42ef4e13
commit 991d3ec1e6
38 changed files with 499 additions and 338 deletions

View File

@@ -63,7 +63,7 @@
#include "nvim/window.h"
#include "nvim/ui.h"
#include "nvim/os/os.h"
#include "nvim/os/event.h"
#include "nvim/event/loop.h"
/*
* Variables shared between getcmdline(), redrawcmdline() and others.
@@ -298,14 +298,14 @@ getcmdline (
/* Get a character. Ignore K_IGNORE, it should not do anything, such
* as stop completion. */
event_enable_deferred();
loop_enable_deferred_events(&loop);
do {
c = safe_vgetc();
} while (c == K_IGNORE);
event_disable_deferred();
loop_disable_deferred_events(&loop);
if (c == K_EVENT) {
event_process();
loop_process_event(&loop);
continue;
}