mirror of
https://github.com/troglobit/libuev.git
synced 2026-10-31 12:20:29 +00:00
Improve documentation for event flags on init and callback
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
649f40e5d3
commit
b67c62045f
3 files changed
+11
-7
No files matched your search
@@ -29,7 +29,8 @@ the wall clock changes, either via NTP or user input.
|
|||||||
/*
|
/*
|
||||||
* Callback example, arg comes from the watcher's *_init() function,
|
* Callback example, arg comes from the watcher's *_init() function,
|
||||||
* w->fd holds the file descriptor or socket, and events is set by
|
* w->fd holds the file descriptor or socket, and events is set by
|
||||||
* libuEv to indicate status: UEV_HUP, UEV_READ and/or UEV_WRITE
|
* libuEv to indicate status: UEV_READ and/or UEV_WRITE with any of
|
||||||
|
* the optional UEV_HUP, UEV_RDHUP, or UEV_PRI for urgent read data.
|
||||||
*/
|
*/
|
||||||
void callback (uev_t *w, void *arg, int events);
|
void callback (uev_t *w, void *arg, int events);
|
||||||
|
|
||||||
@@ -38,10 +39,9 @@ int uev_init (uev_ctx_t *ctx);
|
|||||||
int uev_exit (uev_ctx_t *ctx);
|
int uev_exit (uev_ctx_t *ctx);
|
||||||
int uev_run (uev_ctx_t *ctx, int flags); /* UEV_NONE, UEV_ONCE, and/or UEV_NONBLOCK */
|
int uev_run (uev_ctx_t *ctx, int flags); /* UEV_NONE, UEV_ONCE, and/or UEV_NONBLOCK */
|
||||||
|
|
||||||
/* I/O watcher: fd MUST be non-blocking
|
/* I/O watcher: fd *MUST* be non-blocking!
|
||||||
* events can be any combination of: UEV_READ, UEV_WRITE, UEV_PRI,
|
* events combination of the main flags: UEV_READ, UEV_WRITE,
|
||||||
* UEV_HUP, UEV_RDHUP
|
* UEV_EDGE, UEV_ONESHOT
|
||||||
* UEV_EDGE, UEV_ONESHOT
|
|
||||||
*/
|
*/
|
||||||
int uev_io_init (uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int fd, int events);
|
int uev_io_init (uev_ctx_t *ctx, uev_t *w, uev_cb_t *cb, void *arg, int fd, int events);
|
||||||
int uev_io_set (uev_t *w, int fd, int events);
|
int uev_io_set (uev_t *w, int fd, int events);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
* @param cb I/O callback
|
* @param cb I/O callback
|
||||||
* @param arg Optional callback argument
|
* @param arg Optional callback argument
|
||||||
* @param fd File descriptor to watch, or -1 to register an empty watcher
|
* @param fd File descriptor to watch, or -1 to register an empty watcher
|
||||||
* @param events Requested events to watch for, a mask of %UEV_READ, %UEV_WRITE and %UEV_PRI
|
* @param events Events to watch for: %UEV_READ, %UEV_WRITE, %UEV_EDGE, %UEV_ONESHOW
|
||||||
*
|
*
|
||||||
* @return POSIX OK(0) or non-zero with @param errno set on error.
|
* @return POSIX OK(0) or non-zero with @param errno set on error.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -61,7 +61,11 @@ typedef struct uev {
|
|||||||
uev_ctx_t *ctx;
|
uev_ctx_t *ctx;
|
||||||
} uev_t;
|
} uev_t;
|
||||||
|
|
||||||
/* Generic callback for watchers */
|
/*
|
||||||
|
* Generic callback for watchers, @events holds %UEV_READ and/or %UEV_WRITE
|
||||||
|
* with optional %UEV_PRI (priority data available to read) and any of the
|
||||||
|
* %UEV_HUP and/or %UEV_RDHUP, which may be used to signal hang-up events.
|
||||||
|
*/
|
||||||
typedef void (uev_cb_t)(uev_t *w, void *arg, int events);
|
typedef void (uev_cb_t)(uev_t *w, void *arg, int events);
|
||||||
|
|
||||||
/* Public interface */
|
/* Public interface */
|
||||||
|
|||||||
Reference in new issue
Block a user