- Remove double book keeping, the kernel does all the heavy lifting now - Trim the amount of #includes - Use LIST_ instead of TAILQ_ now that we no longer handle timers ourselves Original LibUEvent $ size libuevent.a libuevent.so.1 text data bss dec hex filename 2610 0 8 2618 a3a libuevent.o (ex libuevent.a) 5266 648 16 5930 172a libuevent.so.1 Refactored libuev: $ size libuev.a libuev.so.1 text data bss dec hex filename 1557 0 0 1557 615 libuev.o (ex libuev.a) 4186 672 8 4866 1302 libuev.so.1 Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
libuev - Micro event loop library
The libuev library is a small event library in the style of libevent, the excellent libev and the venerable Xt(3) event loop.
It is heavily modelled after the libev API, but will never be as portable or friendly to older systems. The focus of this project is modern embedded Linux systems, you will need kernel and C-library support for epoll(7) and timerfd.
Usage
Basically an event context is created to which timer and I/O stream watchers are registered. After initial setup, the typical application enters the event loop that will only return at program termination.
The C API
The typical application will do the following steps
- Create the event context with
uev_ctx_create() - Register callbacks with
uev_io_create()anduev_timer_create() - Enter the event loop with
uev_run()
Note: Make sure to use non-blocking stream I/O!
Build & Install
The library is built and developed for GNU/Linux systems, as such it may use GNU GCC and GNU Make specific features, but may also work with other UNIX systems as well.
make all: The librarymake test: Test and showcasemake install: Honors $prefix and $DESTDIR environment variables
Warning
Please be advised, libuev is not thread safe! It is primarily intended for use-cases where the engineed wants to avoid the use of threads.