Merge pull request #4844 from ZyX-I/rename-main-loop

Rename main loop variable from loop to main_loop
This commit is contained in:
Justin M. Keyes
2016-05-31 13:49:04 -04:00
19 changed files with 66 additions and 51 deletions

View File

@@ -961,7 +961,7 @@ static int insert_handle_key(InsertState *s)
break; break;
case K_EVENT: // some event case K_EVENT: // some event
queue_process_events(loop.events); queue_process_events(main_loop.events);
break; break;
case K_FOCUSGAINED: // Neovim has been given focus case K_FOCUSGAINED: // Neovim has been given focus

View File

@@ -67,6 +67,7 @@
#include "nvim/syntax.h" #include "nvim/syntax.h"
#include "nvim/tag.h" #include "nvim/tag.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/main.h"
#include "nvim/mouse.h" #include "nvim/mouse.h"
#include "nvim/terminal.h" #include "nvim/terminal.h"
#include "nvim/undo.h" #include "nvim/undo.h"
@@ -11812,7 +11813,7 @@ static void f_jobwait(typval_T *argvars, typval_T *rettv)
list_T *rv = list_alloc(); list_T *rv = list_alloc();
ui_busy_start(); ui_busy_start();
Queue *waiting_jobs = queue_new_parent(loop_on_put, &loop); Queue *waiting_jobs = queue_new_parent(loop_on_put, &main_loop);
// For each item in the input list append an integer to the output list. -3 // 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 // is used to represent an invalid job id, -2 is for a interrupted job and
// -1 for jobs that were skipped or timed out. // -1 for jobs that were skipped or timed out.
@@ -11890,7 +11891,7 @@ static void f_jobwait(typval_T *argvars, typval_T *rettv)
} }
// restore the parent queue for the job // restore the parent queue for the job
queue_process_events(data->events); queue_process_events(data->events);
queue_replace_parent(data->events, loop.events); queue_replace_parent(data->events, main_loop.events);
} }
queue_free(waiting_jobs); queue_free(waiting_jobs);
@@ -16534,8 +16535,8 @@ static void f_timer_start(typval_T *argvars, typval_T *rettv)
timer->timer_id = last_timer_id++; timer->timer_id = last_timer_id++;
timer->callback = func; timer->callback = func;
time_watcher_init(&loop, &timer->tw, timer); time_watcher_init(&main_loop, &timer->tw, timer);
timer->tw.events = queue_new_child(loop.events); timer->tw.events = queue_new_child(main_loop.events);
// if main loop is blocked, don't queue up multiple events // if main loop is blocked, don't queue up multiple events
timer->tw.blockable = true; timer->tw.blockable = true;
time_watcher_start(&timer->tw, timer_due_cb, timeout, time_watcher_start(&timer->tw, timer_due_cb, timeout,
@@ -21712,11 +21713,11 @@ static inline TerminalJobData *common_job_init(char **argv,
data->on_stderr = on_stderr; data->on_stderr = on_stderr;
data->on_exit = on_exit; data->on_exit = on_exit;
data->self = self; data->self = self;
data->events = queue_new_child(loop.events); data->events = queue_new_child(main_loop.events);
if (pty) { if (pty) {
data->proc.pty = pty_process_init(&loop, data); data->proc.pty = pty_process_init(&main_loop, data);
} else { } else {
data->proc.uv = libuv_process_init(&loop, data); data->proc.uv = libuv_process_init(&main_loop, data);
} }
Process *proc = (Process *)&data->proc; Process *proc = (Process *)&data->proc;
proc->argv = argv; proc->argv = argv;
@@ -21814,7 +21815,7 @@ static inline void free_term_job_data(TerminalJobData *data)
{ {
// data->queue may still be used after this function returns(process_wait), so // data->queue may still be used after this function returns(process_wait), so
// only free in the next event loop iteration // only free in the next event loop iteration
queue_put(loop.fast_events, free_term_job_data_event, 1, data); queue_put(main_loop.fast_events, free_term_job_data_event, 1, data);
} }
// vimscript job callbacks must be executed on Nvim main loop // vimscript job callbacks must be executed on Nvim main loop

View File

@@ -6992,7 +6992,7 @@ void do_sleep(long msec)
ui_flush(); // flush before waiting ui_flush(); // flush before waiting
for (long left = msec; !got_int && left > 0; left -= 1000L) { for (long left = msec; !got_int && left > 0; left -= 1000L) {
int next = left > 1000l ? 1000 : (int)left; int next = left > 1000l ? 1000 : (int)left;
LOOP_PROCESS_EVENTS_UNTIL(&loop, loop.events, (int)next, got_int); LOOP_PROCESS_EVENTS_UNTIL(&main_loop, main_loop.events, (int)next, got_int);
os_breakcheck(); os_breakcheck();
} }
} }

View File

@@ -358,7 +358,7 @@ static int command_line_execute(VimState *state, int key)
s->c = key; s->c = key;
if (s->c == K_EVENT) { if (s->c == K_EVENT) {
queue_process_events(loop.events); queue_process_events(main_loop.events);
redrawcmdline(); redrawcmdline();
return 1; return 1;
} }

View File

@@ -1243,7 +1243,6 @@ EXTERN char *ignoredp;
// If a msgpack-rpc channel should be started over stdin/stdout // If a msgpack-rpc channel should be started over stdin/stdout
EXTERN bool embedded_mode INIT(= false); EXTERN bool embedded_mode INIT(= false);
EXTERN Loop loop;
/// Used to track the status of external functions. /// Used to track the status of external functions.
/// Currently only used for iconv(). /// Currently only used for iconv().

View File

@@ -120,6 +120,8 @@ typedef struct {
# include "main.c.generated.h" # include "main.c.generated.h"
#endif #endif
Loop main_loop;
static char *argv0; static char *argv0;
// Error messages // Error messages
@@ -133,7 +135,7 @@ static const char *err_extra_cmd =
void event_init(void) void event_init(void)
{ {
loop_init(&loop, NULL); loop_init(&main_loop, NULL);
// early msgpack-rpc initialization // early msgpack-rpc initialization
msgpack_rpc_init_method_table(); msgpack_rpc_init_method_table();
msgpack_rpc_helpers_init(); msgpack_rpc_helpers_init();
@@ -151,19 +153,19 @@ void event_init(void)
void event_teardown(void) void event_teardown(void)
{ {
if (!loop.events) { if (!main_loop.events) {
return; return;
} }
queue_process_events(loop.events); queue_process_events(main_loop.events);
input_stop(); input_stop();
channel_teardown(); channel_teardown();
process_teardown(&loop); process_teardown(&main_loop);
server_teardown(); server_teardown();
signal_teardown(); signal_teardown();
terminal_teardown(); terminal_teardown();
loop_close(&loop); loop_close(&main_loop);
} }
/// Performs early initialization. /// Performs early initialization.

View File

@@ -2,6 +2,9 @@
#define NVIM_MAIN_H #define NVIM_MAIN_H
#include "nvim/normal.h" #include "nvim/normal.h"
#include "nvim/event/loop.h"
extern Loop main_loop;
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "main.h.generated.h" # include "main.h.generated.h"

View File

@@ -16,6 +16,7 @@
#include "nvim/event/socket.h" #include "nvim/event/socket.h"
#include "nvim/msgpack_rpc/helpers.h" #include "nvim/msgpack_rpc/helpers.h"
#include "nvim/vim.h" #include "nvim/vim.h"
#include "nvim/main.h"
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/os_unix.h" #include "nvim/os_unix.h"
@@ -119,7 +120,7 @@ void channel_teardown(void)
uint64_t channel_from_process(char **argv) uint64_t channel_from_process(char **argv)
{ {
Channel *channel = register_channel(kChannelTypeProc); Channel *channel = register_channel(kChannelTypeProc);
channel->data.process.uvproc = libuv_process_init(&loop, channel); channel->data.process.uvproc = libuv_process_init(&main_loop, channel);
Process *proc = &channel->data.process.uvproc.process; Process *proc = &channel->data.process.uvproc.process;
proc->argv = argv; proc->argv = argv;
proc->in = &channel->data.process.in; proc->in = &channel->data.process.in;
@@ -127,7 +128,7 @@ uint64_t channel_from_process(char **argv)
proc->err = &channel->data.process.err; proc->err = &channel->data.process.err;
proc->cb = process_exit; proc->cb = process_exit;
if (!process_spawn(proc)) { if (!process_spawn(proc)) {
loop_poll_events(&loop, 0); loop_poll_events(&main_loop, 0);
decref(channel); decref(channel);
return 0; return 0;
} }
@@ -220,7 +221,7 @@ Object channel_send_call(uint64_t id,
ChannelCallFrame frame = { request_id, false, false, NIL }; ChannelCallFrame frame = { request_id, false, false, NIL };
kv_push(channel->call_stack, &frame); kv_push(channel->call_stack, &frame);
channel->pending_requests++; channel->pending_requests++;
LOOP_PROCESS_EVENTS_UNTIL(&loop, channel->events, -1, frame.returned); LOOP_PROCESS_EVENTS_UNTIL(&main_loop, channel->events, -1, frame.returned);
(void)kv_pop(channel->call_stack); (void)kv_pop(channel->call_stack);
channel->pending_requests--; channel->pending_requests--;
@@ -316,11 +317,11 @@ void channel_from_stdio(void)
Channel *channel = register_channel(kChannelTypeStdio); Channel *channel = register_channel(kChannelTypeStdio);
incref(channel); // stdio channels are only closed on exit incref(channel); // stdio channels are only closed on exit
// read stream // read stream
rstream_init_fd(&loop, &channel->data.std.in, 0, CHANNEL_BUFFER_SIZE, rstream_init_fd(&main_loop, &channel->data.std.in, 0, CHANNEL_BUFFER_SIZE,
channel); channel);
rstream_start(&channel->data.std.in, parse_msgpack); rstream_start(&channel->data.std.in, parse_msgpack);
// write stream // write stream
wstream_init_fd(&loop, &channel->data.std.out, 1, 0, NULL); wstream_init_fd(&main_loop, &channel->data.std.out, 1, 0, NULL);
} }
static void forward_stderr(Stream *stream, RBuffer *rbuf, size_t count, static void forward_stderr(Stream *stream, RBuffer *rbuf, size_t count,
@@ -646,7 +647,7 @@ static void close_channel(Channel *channel)
case kChannelTypeStdio: case kChannelTypeStdio:
stream_close(&channel->data.std.in, NULL); stream_close(&channel->data.std.in, NULL);
stream_close(&channel->data.std.out, NULL); stream_close(&channel->data.std.out, NULL);
queue_put(loop.fast_events, exit_event, 1, channel); queue_put(main_loop.fast_events, exit_event, 1, channel);
return; return;
default: default:
abort(); abort();
@@ -691,7 +692,7 @@ static void close_cb(Stream *stream, void *data)
static Channel *register_channel(ChannelType type) static Channel *register_channel(ChannelType type)
{ {
Channel *rv = xmalloc(sizeof(Channel)); Channel *rv = xmalloc(sizeof(Channel));
rv->events = queue_new_child(loop.events); rv->events = queue_new_child(main_loop.events);
rv->type = type; rv->type = type;
rv->refcount = 1; rv->refcount = 1;
rv->closed = false; rv->closed = false;

View File

@@ -12,6 +12,7 @@
#include "nvim/eval.h" #include "nvim/eval.h"
#include "nvim/garray.h" #include "nvim/garray.h"
#include "nvim/vim.h" #include "nvim/vim.h"
#include "nvim/main.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/log.h" #include "nvim/log.h"
#include "nvim/fileio.h" #include "nvim/fileio.h"
@@ -108,7 +109,7 @@ int server_start(const char *endpoint)
} }
SocketWatcher *watcher = xmalloc(sizeof(SocketWatcher)); SocketWatcher *watcher = xmalloc(sizeof(SocketWatcher));
socket_watcher_init(&loop, watcher, endpoint, NULL); socket_watcher_init(&main_loop, watcher, endpoint, NULL);
// Check if a watcher for the endpoint already exists // Check if a watcher for the endpoint already exists
for (int i = 0; i < watchers.ga_len; i++) { for (int i = 0; i < watchers.ga_len; i++) {

View File

@@ -7879,7 +7879,7 @@ static void nv_event(cmdarg_T *cap)
// not safe to perform garbage collection because there could be unreferenced // not safe to perform garbage collection because there could be unreferenced
// lists or dicts being used. // lists or dicts being used.
may_garbage_collect = false; may_garbage_collect = false;
queue_process_events(loop.events); queue_process_events(main_loop.events);
cap->retval |= CA_COMMAND_BUSY; // don't call edit() now cap->retval |= CA_COMMAND_BUSY; // don't call edit() now
} }

View File

@@ -60,7 +60,7 @@ void input_start(int fd)
} }
global_fd = fd; global_fd = fd;
rstream_init_fd(&loop, &read_stream, fd, READ_BUFFER_SIZE, NULL); rstream_init_fd(&main_loop, &read_stream, fd, READ_BUFFER_SIZE, NULL);
rstream_start(&read_stream, read_cb); rstream_start(&read_stream, read_cb);
} }
@@ -87,8 +87,8 @@ static void create_cursorhold_event(void)
// have been called(inbuf_poll would return kInputAvail) // have been called(inbuf_poll would return kInputAvail)
// TODO(tarruda): Cursorhold should be implemented as a timer set during the // TODO(tarruda): Cursorhold should be implemented as a timer set during the
// `state_check` callback for the states where it can be triggered. // `state_check` callback for the states where it can be triggered.
assert(!events_enabled || queue_empty(loop.events)); assert(!events_enabled || queue_empty(main_loop.events));
queue_put(loop.events, cursorhold_event, 0); queue_put(main_loop.events, cursorhold_event, 0);
} }
// Low level input function // Low level input function
@@ -147,7 +147,7 @@ bool os_char_avail(void)
void os_breakcheck(void) void os_breakcheck(void)
{ {
if (!got_int) { if (!got_int) {
loop_poll_events(&loop, 0); loop_poll_events(&main_loop, 0);
} }
} }
@@ -322,7 +322,7 @@ static bool input_poll(int ms)
prof_inchar_enter(); prof_inchar_enter();
} }
LOOP_PROCESS_EVENTS_UNTIL(&loop, NULL, ms, input_ready() || input_eof); LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, ms, input_ready() || input_eof);
if (do_profiling == PROF_YES && ms) { if (do_profiling == PROF_YES && ms) {
prof_inchar_exit(); prof_inchar_exit();
@@ -419,5 +419,5 @@ static void read_error_exit(void)
static bool pending_events(void) static bool pending_events(void)
{ {
return events_enabled && !queue_empty(loop.events); return events_enabled && !queue_empty(main_loop.events);
} }

View File

@@ -14,6 +14,7 @@
#include "nvim/os/shell.h" #include "nvim/os/shell.h"
#include "nvim/os/signal.h" #include "nvim/os/signal.h"
#include "nvim/types.h" #include "nvim/types.h"
#include "nvim/main.h"
#include "nvim/vim.h" #include "nvim/vim.h"
#include "nvim/message.h" #include "nvim/message.h"
#include "nvim/memory.h" #include "nvim/memory.h"
@@ -205,16 +206,16 @@ static int do_os_system(char **argv,
xstrlcpy(prog, argv[0], MAXPATHL); xstrlcpy(prog, argv[0], MAXPATHL);
Stream in, out, err; Stream in, out, err;
LibuvProcess uvproc = libuv_process_init(&loop, &buf); LibuvProcess uvproc = libuv_process_init(&main_loop, &buf);
Process *proc = &uvproc.process; Process *proc = &uvproc.process;
Queue *events = queue_new_child(loop.events); Queue *events = queue_new_child(main_loop.events);
proc->events = events; proc->events = events;
proc->argv = argv; proc->argv = argv;
proc->in = input != NULL ? &in : NULL; proc->in = input != NULL ? &in : NULL;
proc->out = &out; proc->out = &out;
proc->err = &err; proc->err = &err;
if (!process_spawn(proc)) { if (!process_spawn(proc)) {
loop_poll_events(&loop, 0); loop_poll_events(&main_loop, 0);
// Failed, probably due to `sh` not being executable // Failed, probably due to `sh` not being executable
if (!silent) { if (!silent) {
MSG_PUTS(_("\nCannot execute ")); MSG_PUTS(_("\nCannot execute "));

View File

@@ -8,6 +8,7 @@
#include "nvim/globals.h" #include "nvim/globals.h"
#include "nvim/memline.h" #include "nvim/memline.h"
#include "nvim/eval.h" #include "nvim/eval.h"
#include "nvim/main.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/misc1.h" #include "nvim/misc1.h"
#include "nvim/misc2.h" #include "nvim/misc2.h"
@@ -28,10 +29,10 @@ static bool rejecting_deadly;
void signal_init(void) void signal_init(void)
{ {
signal_watcher_init(&loop, &spipe, NULL); signal_watcher_init(&main_loop, &spipe, NULL);
signal_watcher_init(&loop, &shup, NULL); signal_watcher_init(&main_loop, &shup, NULL);
signal_watcher_init(&loop, &squit, NULL); signal_watcher_init(&main_loop, &squit, NULL);
signal_watcher_init(&loop, &sterm, NULL); signal_watcher_init(&main_loop, &sterm, NULL);
#ifdef SIGPIPE #ifdef SIGPIPE
signal_watcher_start(&spipe, on_signal, SIGPIPE); signal_watcher_start(&spipe, on_signal, SIGPIPE);
#endif #endif
@@ -41,7 +42,7 @@ void signal_init(void)
#endif #endif
signal_watcher_start(&sterm, on_signal, SIGTERM); signal_watcher_start(&sterm, on_signal, SIGTERM);
#ifdef SIGPWR #ifdef SIGPWR
signal_watcher_init(&loop, &spwr, NULL); signal_watcher_init(&main_loop, &spwr, NULL);
signal_watcher_start(&spwr, on_signal, SIGPWR); signal_watcher_start(&spwr, on_signal, SIGPWR);
#endif #endif
} }

View File

@@ -9,6 +9,7 @@
#include "nvim/os/time.h" #include "nvim/os/time.h"
#include "nvim/event/loop.h" #include "nvim/event/loop.h"
#include "nvim/vim.h" #include "nvim/vim.h"
#include "nvim/main.h"
static uv_mutex_t delay_mutex; static uv_mutex_t delay_mutex;
static uv_cond_t delay_cond; static uv_cond_t delay_cond;
@@ -43,7 +44,7 @@ void os_delay(uint64_t milliseconds, bool ignoreinput)
if (milliseconds > INT_MAX) { if (milliseconds > INT_MAX) {
milliseconds = INT_MAX; milliseconds = INT_MAX;
} }
LOOP_PROCESS_EVENTS_UNTIL(&loop, NULL, (int)milliseconds, got_int); LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, (int)milliseconds, got_int);
} else { } else {
os_microdelay(milliseconds * 1000); os_microdelay(milliseconds * 1000);
} }

View File

@@ -4,6 +4,7 @@
#include "nvim/state.h" #include "nvim/state.h"
#include "nvim/vim.h" #include "nvim/vim.h"
#include "nvim/main.h"
#include "nvim/getchar.h" #include "nvim/getchar.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/os/input.h" #include "nvim/os/input.h"
@@ -32,7 +33,7 @@ getkey:
// processing. Characters can come from mappings, scripts and other // processing. Characters can come from mappings, scripts and other
// sources, so this scenario is very common. // sources, so this scenario is very common.
key = safe_vgetc(); key = safe_vgetc();
} else if (!queue_empty(loop.events)) { } else if (!queue_empty(main_loop.events)) {
// Event was made available after the last queue_process_events call // Event was made available after the last queue_process_events call
key = K_EVENT; key = K_EVENT;
} else { } else {
@@ -45,7 +46,7 @@ getkey:
// directly. // directly.
(void)os_inchar(NULL, 0, -1, 0); (void)os_inchar(NULL, 0, -1, 0);
input_disable_events(); input_disable_events();
key = !queue_empty(loop.events) ? K_EVENT : safe_vgetc(); key = !queue_empty(main_loop.events) ? K_EVENT : safe_vgetc();
} }
if (key == K_EVENT) { if (key == K_EVENT) {

View File

@@ -63,6 +63,7 @@
#include "nvim/map.h" #include "nvim/map.h"
#include "nvim/misc1.h" #include "nvim/misc1.h"
#include "nvim/move.h" #include "nvim/move.h"
#include "nvim/main.h"
#include "nvim/state.h" #include "nvim/state.h"
#include "nvim/ex_docmd.h" #include "nvim/ex_docmd.h"
#include "nvim/ex_cmds.h" #include "nvim/ex_cmds.h"
@@ -163,9 +164,9 @@ static VTermColor default_vt_bg_rgb;
void terminal_init(void) void terminal_init(void)
{ {
invalidated_terminals = pmap_new(ptr_t)(); invalidated_terminals = pmap_new(ptr_t)();
time_watcher_init(&loop, &refresh_timer, NULL); time_watcher_init(&main_loop, &refresh_timer, NULL);
// refresh_timer_cb will redraw the screen which can call vimscript // refresh_timer_cb will redraw the screen which can call vimscript
refresh_timer.events = queue_new_child(loop.events); refresh_timer.events = queue_new_child(main_loop.events);
// initialize a rgb->color index map for cterm attributes(VTermScreenCell // initialize a rgb->color index map for cterm attributes(VTermScreenCell
// only has RGB information and we need color indexes for terminal UIs) // only has RGB information and we need color indexes for terminal UIs)
@@ -452,7 +453,7 @@ static int terminal_execute(VimState *state, int key)
case K_EVENT: case K_EVENT:
// We cannot let an event free the terminal yet. It is still needed. // We cannot let an event free the terminal yet. It is still needed.
s->term->refcount++; s->term->refcount++;
queue_process_events(loop.events); queue_process_events(main_loop.events);
s->term->refcount--; s->term->refcount--;
if (s->term->buf_handle == 0) { if (s->term->buf_handle == 0) {
s->close = true; s->close = true;

View File

@@ -4,6 +4,7 @@
#include "nvim/api/vim.h" #include "nvim/api/vim.h"
#include "nvim/api/private/helpers.h" #include "nvim/api/private/helpers.h"
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/main.h"
#include "nvim/misc2.h" #include "nvim/misc2.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/input.h" #include "nvim/os/input.h"
@@ -92,7 +93,7 @@ static void flush_input(TermInput *input, bool wait_until_empty)
size_t drain_boundary = wait_until_empty ? 0 : 0xff; size_t drain_boundary = wait_until_empty ? 0 : 0xff;
do { do {
uv_mutex_lock(&input->key_buffer_mutex); uv_mutex_lock(&input->key_buffer_mutex);
loop_schedule(&loop, event_create(1, wait_input_enqueue, 1, input)); loop_schedule(&main_loop, event_create(1, wait_input_enqueue, 1, input));
input->waiting = true; input->waiting = true;
while (input->waiting) { while (input->waiting) {
uv_cond_wait(&input->key_buffer_cond, &input->key_buffer_mutex); uv_cond_wait(&input->key_buffer_cond, &input->key_buffer_mutex);
@@ -336,7 +337,7 @@ static void read_cb(Stream *stream, RBuffer *buf, size_t c, void *data,
stream_close(&input->read_stream, NULL); stream_close(&input->read_stream, NULL);
queue_put(input->loop->fast_events, restart_reading, 1, input); queue_put(input->loop->fast_events, restart_reading, 1, input);
} else { } else {
loop_schedule(&loop, event_create(1, input_done_event, 0)); loop_schedule(&main_loop, event_create(1, input_done_event, 0));
} }
return; return;
} }

View File

@@ -11,6 +11,7 @@
#include "nvim/vim.h" #include "nvim/vim.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/map.h" #include "nvim/map.h"
#include "nvim/main.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/api/vim.h" #include "nvim/api/vim.h"
#include "nvim/api/private/helpers.h" #include "nvim/api/private/helpers.h"
@@ -261,7 +262,7 @@ static void sigwinch_cb(SignalWatcher *watcher, int signum, void *data)
UI *ui = data; UI *ui = data;
update_size(ui); update_size(ui);
// run refresh_event in nvim main loop // run refresh_event in nvim main loop
loop_schedule(&loop, event_create(1, refresh_event, 0)); loop_schedule(&main_loop, event_create(1, refresh_event, 0));
} }
static bool attrs_differ(HlAttrs a1, HlAttrs a2) static bool attrs_differ(HlAttrs a1, HlAttrs a2)

View File

@@ -5,6 +5,7 @@
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#include "nvim/main.h"
#include "nvim/vim.h" #include "nvim/vim.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/memory.h" #include "nvim/memory.h"
@@ -100,7 +101,7 @@ static void ui_bridge_stop(UI *b)
if (stopped) { if (stopped) {
break; break;
} }
loop_poll_events(&loop, 10); loop_poll_events(&main_loop, 10);
} }
uv_thread_join(&bridge->ui_thread); uv_thread_join(&bridge->ui_thread);
uv_mutex_destroy(&bridge->mutex); uv_mutex_destroy(&bridge->mutex);