This patch replaces the BSD doubly linked list implementation with a
simplified homegrown version. This not only reduces the dependency on
an external "library", but also greatly simplifies licensing and gives
us a clean name space that does not intrude on users who want to use
their own version of queue.h in their application that also includes
the libuEv header file.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch is a follow-up to 2f9cce9, and a complete refactor of
fe8f3f1 which first introduced the EPOLLERR and EPOLLHUP handling.
Then mainly for managing errors and hangups on stream sockets.
Now, instead of trying to reopen the epoll() fd, and breaking out
hard from the event loop on catastrophic error, we now delegate
I/O watcher EPOLLERR and EPOLLHUP to the watcher callback, just
like other watchers.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch fixes a blocking issue discovered in the Finit project.
At shutdown, or when there is any problem with a timer or signal
watcher, the event loop is abruptly terminated.
Instead of unconditionally exiting the event loop on problems with a
single watcher, invalidate the watcher and run the callback one last
time with UEV_ERROR in the events argument.
This is a semantic change wrt. watchers and their callbacks, so the
major version number will be bumped accordingly to signal the severity
of this change. From now on it is STRONGLY recommended that each call
back function check for UEV_ERROR.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch implements a workaround for issue #12, i.e. when an I/O
watcher for redirected stdin is registered and causes epoll_ctl()
to return EPERM.
The workaround registers the watcher as `active = -1` and bypasses
the epoll_wait() call in the main loop until all data has been read
from stdin and the temporary -1 watcher(s) have completed.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>