From 59afe579956bfdc4a7d228bb78681b5dc65e78ca Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 28 Dec 2014 21:54:40 +0100 Subject: [PATCH] Minor update to README Signed-off-by: Joachim Nilsson --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8b7e30e..4c77670 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ libuev | Micro event loop library Libuev is a small event library in the style of libevent, the excellent libev and the venerable Xt(3) event loop. The primary target is modern -embedded Linux systems. +embedded Linux systems. For power users, libuev is mainly a convenience +wrapper for epoll, timerfd and signalfd. Usage @@ -19,12 +20,17 @@ loop that will only return at program termination. 3. Enter the event loop with `uev_run()` 4. Exit the event loop with `uev_exit()`, possibly from a callback -**Note:** Make sure to use non-blocking stream I/O! +**Note:** Make sure to use non-blocking stream I/O! Most hard to find + bugs in event driven applications is due to file descriptors and + sockets being opened in blocking mode. Be careful out there! Example ------- +Here is a very brief example to illustrate how one can use libuev. But +please, pay more attention to return values than the author did below. + #include "uev.h" static void signal_cb(uev_ctx_t *ctx, uev_t *w, void *UNUSED(arg), int UNUSED(events)) @@ -57,6 +63,9 @@ Example return uev_run(&ctx); } +For a more complete, and perhaps more relevant example, see the code for +the TFTP/FTP server [uftpd](https://github.com/troglobit/uftpd). + API ---