mirror of
https://github.com/troglobit/libuev.git
synced 2026-11-17 19:31:18 +00:00
README.md: Last update, possibly. Mostly tweaks and cleanup.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
e50f8aee94
commit
3094ef2887
1 file changed
+21
-21
@@ -1,7 +1,7 @@
|
|||||||
libuEv | Simple event loop for Linux
|
libuEv | Simple event loop for Linux
|
||||||
====================================
|
====================================
|
||||||
|
|
||||||
> "Why an event loop, why not use threads?"
|
> “Why an event loop, why not use threads?”
|
||||||
|
|
||||||
With the advent of light-weight processes (threads) programmers these
|
With the advent of light-weight processes (threads) programmers these
|
||||||
days have a [golden hammer](http://c2.com/cgi/wiki?GoldenHammer) they
|
days have a [golden hammer](http://c2.com/cgi/wiki?GoldenHammer) they
|
||||||
@@ -27,7 +27,7 @@ in mind, however, that not all systems your application will run on have
|
|||||||
multiple CPU cores -- some small embedded systems still use a single CPU
|
multiple CPU cores -- some small embedded systems still use a single CPU
|
||||||
core, even though they run Linux, with multiple threads a program may
|
core, even though they run Linux, with multiple threads a program may
|
||||||
actually run slower! Always profile your program, and if possible, test
|
actually run slower! Always profile your program, and if possible, test
|
||||||
it on several different architectures.
|
it on different architectures.
|
||||||
|
|
||||||
LibuEv is a simple event loop in the style of the more established
|
LibuEv is a simple event loop in the style of the more established
|
||||||
[libevent](http://libevent.org/),
|
[libevent](http://libevent.org/),
|
||||||
@@ -86,7 +86,7 @@ callback to the event context by passing the `uev_ctx_t` variable, along
|
|||||||
with an `uev_t` variable to each event's `_init()` function.
|
with an `uev_t` variable to each event's `_init()` function.
|
||||||
|
|
||||||
When all watchers are registered call the event loop with `uev_run()`
|
When all watchers are registered call the event loop with `uev_run()`
|
||||||
and the argument to the event context. The flags parameter is slightly
|
and the argument to the event context. The `flags` parameter is slightly
|
||||||
mysterious, but can be used to integrate libuEv into another event loop.
|
mysterious, but can be used to integrate libuEv into another event loop.
|
||||||
With `flags` set to `UEV_ONCE` the event loop returns after having
|
With `flags` set to `UEV_ONCE` the event loop returns after having
|
||||||
served the first event. If `flags` is set to `UEV_ONCE | UEV_NONBLOCK`
|
served the first event. If `flags` is set to `UEV_ONCE | UEV_NONBLOCK`
|
||||||
@@ -94,15 +94,15 @@ the event loop returns immediately if no event is available.
|
|||||||
|
|
||||||
Summary:
|
Summary:
|
||||||
|
|
||||||
1. Prepare an event context with `uev_init()`
|
1. Prepare an event context with `uev_init()`
|
||||||
2. Register event callbacks with `uev_io_init()`, `uev_signal_init()`
|
2. Register event callbacks with `uev_io_init()`, `uev_signal_init()`
|
||||||
or `uev_timer_init()`
|
or `uev_timer_init()`
|
||||||
3. Enter the event loop with `uev_run()`
|
3. Enter the event loop with `uev_run()`
|
||||||
4. Leave the event loop with `uev_exit()`, possibly from a callback
|
4. Leave the event loop with `uev_exit()`, possibly from a callback
|
||||||
|
|
||||||
**Note:** Make sure to use non-blocking stream I/O! Most hard to find
|
**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
|
bugs in event driven applications is due to file descriptors and sockets
|
||||||
sockets being opened in blocking mode. Be careful out there!
|
being opened in blocking mode. Be careful out there!
|
||||||
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
@@ -183,9 +183,9 @@ The library is built and developed for GNU/Linux systems, as such it may
|
|||||||
use GNU GCC and GNU Make specific features. Patches to support *BSD
|
use GNU GCC and GNU Make specific features. Patches to support *BSD
|
||||||
kqueue are most welcome.
|
kqueue are most welcome.
|
||||||
|
|
||||||
* `make all`: The library
|
* `make all`: The library
|
||||||
* `make test`: Test and showcase
|
* `make test`: Test and showcase
|
||||||
* `make install`: Honors `$prefix` and `$DESTDIR` environment variables
|
* `make install`: Honors `$prefix` and `$DESTDIR` environment variables
|
||||||
|
|
||||||
Size of libuEv:
|
Size of libuEv:
|
||||||
|
|
||||||
@@ -209,21 +209,21 @@ Size of libuEv:
|
|||||||
Origin & References
|
Origin & References
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
LibuEv was originally based on
|
LibuEv (this library) was originally based on
|
||||||
[LibUEvent](http://code.google.com/p/libuevent/) by
|
[LibUEvent](http://code.google.com/p/libuevent/) by
|
||||||
[Flemming Madsen](http://www.madsensoft.dk/) but has been completely
|
[Flemming Madsen](http://www.madsensoft.dk/) but has been completely
|
||||||
rewritten and is now more similar to the famous
|
rewritten with a much clearer API. Now more similar to the famous
|
||||||
[libev](http://software.schmorp.de/pkg/libev.html) by Mark Lehmann.
|
[libev](http://software.schmorp.de/pkg/libev.html) by Mark Lehmann.
|
||||||
Another small event library used for inspiration is the very small
|
Another small event library used for inspiration is the very small
|
||||||
[Picoev](https://github.com/kazuho/picoev) by
|
[Picoev](https://github.com/kazuho/picoev) by
|
||||||
[Oku Kazuho](https://github.com/kazuho).
|
[Oku Kazuho](https://github.com/kazuho).
|
||||||
|
|
||||||
* http://code.google.com/p/libuevent/
|
* http://code.google.com/p/libuevent/
|
||||||
* http://software.schmorp.de/pkg/libev.html
|
* http://software.schmorp.de/pkg/libev.html
|
||||||
* http://libev.schmorp.de/bench.html
|
* http://libev.schmorp.de/bench.html
|
||||||
* http://libevent.org/
|
* http://libevent.org/
|
||||||
* http://developer.cybozu.co.jp/archives/kazuho/2009/08/picoev-a-tiny-e.html
|
* http://developer.cybozu.co.jp/archives/kazuho/2009/08/picoev-a-tiny-e.html
|
||||||
* http://coderepos.org/share/browser/lang/c/picoev/
|
* http://coderepos.org/share/browser/lang/c/picoev/
|
||||||
|
|
||||||
LibuEv is maintained by [Joachim Nilsson](mailto:troglobit@gmail.com) at
|
LibuEv is maintained by [Joachim Nilsson](mailto:troglobit@gmail.com) at
|
||||||
[GitHub](https://github.com/troglobit/libuev)
|
[GitHub](https://github.com/troglobit/libuev)
|
||||||
|
|||||||
Reference in new issue
Block a user