Commit Graph
9 Commits
Author SHA1 Message Date
Joachim Nilsson 6fa88eacb4 Add new API; uev_init1(ctx, maxevents) to cap event cache size
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-10-02 17:49:32 +02:00
Joachim Nilsson e6b99da0f5 Refactor, replace BSD queue.h LIST_ macros with homegrown version
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>
2018-09-25 23:31:23 +02:00
Joachim Nilsson ebe3888d6f Minor, whitespace fixes
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-25 23:23:43 +02:00
Joachim Nilsson 35a54ef75e Follow-up to 2f9cce9, handle I/O watchers similar to timer+signal
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>
2017-11-14 12:16:23 +01:00
Joachim Nilsson 7c86cc31f1 Reorder enum in order of first appearance in libuEv
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-13 15:02:06 +01:00
Joachim Nilsson 2f9cce9150 Do NOT exit event loop on timer/signal watcher error
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>
2017-11-10 22:18:40 +01:00
Joachim Nilsson e0cebc33b1 Fix #12: Implement workaround for application < foo.txt
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>
2017-10-21 19:10:04 +02:00
Joachim Nilsson 6f5e6e5232 Make internal API more private
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-10-21 12:04:13 +02:00
Joachim Nilsson ed5c9bb06c Relocate source fiiles to src/ subdirectory
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-19 08:12:21 +02:00