neovim/neovim — pull request #424 by tarruda (2014-03-29 15:05:18+00:00)
Title: [RFC] Refactor event.c to enable `event_poll` recursion

This is trying to fix the problems reported by @philix / @stefan991 in #410. I felt that this belongs to another PR since it's not specifically related to signal handling.

After examining the [event loop code](https://github.com/joyent/libuv/blob/e7fdab1fd946cb76d5db5fb3bc34077fff137cd7/src/unix/core.c#L273) I think it's safe to assume that there's no problem in calling it recursively, as long as the relevant watchers are allocated on the stack.

A static function variable is used to detect recursion(I would appreciate a better alternative, and only call `input_start`/`input_stop` if its the top-level call.

@saghul am I wrong to assume its ok to call `uv_run` recursively?