loop_close: Avoid infinite loop, and log it.

Avoids a hang, and also helps diagnose issues like:

https://github.com/neovim/neovim/pull/6594#issuecomment-298321826
This commit is contained in:
Justin M. Keyes
2017-05-30 01:25:25 +02:00
parent f83d733318
commit 698ec9eb6e
4 changed files with 27 additions and 7 deletions

View File

@@ -153,10 +153,11 @@ void event_init(void)
terminal_init();
}
void event_teardown(void)
/// @returns false if main_loop could not be closed gracefully
bool event_teardown(void)
{
if (!main_loop.events) {
return;
return true;
}
multiqueue_process_events(main_loop.events);
@@ -168,7 +169,7 @@ void event_teardown(void)
signal_teardown();
terminal_teardown();
loop_close(&main_loop, true);
return loop_close(&main_loop, true);
}
/// Performs early initialization.