From 84661a1b12d4be6a046cc8b14bf3ce47e2cd908e Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Tue, 14 Nov 2017 12:11:36 +0100 Subject: [PATCH] README: Mention error handling early, and point to API docs Signed-off-by: Joachim Nilsson --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 75000a4..4c4ac86 100644 --- a/README.md +++ b/README.md @@ -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 the [ChangeLog][] for the full details. +The [API documentation](API.md) is available as a separate document. + 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 #include @@ -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) { + if (UEV_ERROR == events) { + puts("Problem with timer, attempting to restart."); + uev_timer_start(w); + } puts("Every other second"); }