Joachim Nilsson ec9351bfdd Add support for peridic timers and resetting timers
Refactor uev_timer_create() to support a periodic (msec) argument. For
such timers libuev automaticlly respawns them.  Effectively resetting
the timeout using the period value.

Also, refactor argument order to uev_timer_create() and uev_io_create().

Rename UEV_FHIN, UEV_FHOUT to UEV_DIR_INBOUND and UEV_DIR_OUTBOUND.

Remove unnecessary return value for watcher callbacks.  What would those
have been usefu for, ever?  Not even the original code checked the return
value after calling a handler.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-07-21 11:39:26 +02:00

libuev - Asynchronous event loop library

The libuev library is a small event library in the style of the venerable Xt(3) event loop.

Basically an event context is created,and handlers for timeounts and stream events can be registered with this context.

After initial setup, the typical application will enter the event loop that will only return at program termination.

The C API

The typical application will do the following steps

  1. Create the event context with uev_ctx_create()
  2. Register callbacks with uev_io_create() and uev_timer_create()
  3. Enter the event loop with uev_run()

Building

Use make:

  • make all: The library
  • make test: Test and showcase

Installation

Is purely manual, but would be something along the lines of: sudo install -m 444 libuev.so.1 /usr/lib/libuev.so.1

Warning

Not thread safe!

The ctxt structure needs mutex protection in case of multi threaded access.

S
Description
Lightweight event loop library for Linux epoll() family APIs
Readme MIT
953 KiB
Languages
C 71.5%
M4 25%
Makefile 3.4%