README: Mention error handling early, and point to API docs

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-11-14 12:56:39 +01:00
1 parent ed313a1422
commit 84661a1b12
1 file changed
+10 -1
+10 -1
View File
@@ -28,11 +28,16 @@ small size overhead impact of the library.
Failure mode changes introduced in v2.0 may affect users of v1.x, See Failure mode changes introduced in v2.0 may affect users of v1.x, See
the [ChangeLog][] for the full details. the [ChangeLog][] for the full details.
The [API documentation](API.md) is available as a separate document.
Example Example
------- -------
The library documentation is available as a [separate document](API.md). Notice below how watcher `UEV_ERROR` conditions must be handled by each
callback. I/O watchers must also check for `UEV_HUP`. Both errors are
usually fatal, libuEv makes sure to stop each watcher before a callback
runs, leaving it up to the callback to take appropriate action.
```C ```C
#include <stdio.h> #include <stdio.h>
@@ -40,6 +45,10 @@ The library documentation is available as a [separate document](API.md).
static void cb(uev_t *w, void *arg, int events) static void cb(uev_t *w, void *arg, int events)
{ {
if (UEV_ERROR == events) {
puts("Problem with timer, attempting to restart.");
uev_timer_start(w);
}
puts("Every other second"); puts("Every other second");
} }