mirror of
https://github.com/troglobit/libuev.git
synced 2026-11-10 16:31:08 +00:00
Minor update to README
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
1dfdc875d7
commit
59afe57995
1 file changed
+11
-2
@@ -3,7 +3,8 @@ libuev | Micro event loop library
|
|||||||
|
|
||||||
Libuev is a small event library in the style of libevent, the excellent
|
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
|
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
|
Usage
|
||||||
@@ -19,12 +20,17 @@ loop that will only return at program termination.
|
|||||||
3. Enter the event loop with `uev_run()`
|
3. Enter the event loop with `uev_run()`
|
||||||
4. Exit the event loop with `uev_exit()`, possibly from a callback
|
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
|
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"
|
#include "uev.h"
|
||||||
|
|
||||||
static void signal_cb(uev_ctx_t *ctx, uev_t *w, void *UNUSED(arg), int UNUSED(events))
|
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);
|
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
|
API
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in new issue
Block a user