mirror of
https://github.com/troglobit/libuev.git
synced 2026-10-31 12:20:29 +00:00
Update doc comments to proper doxygen syntax
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
da080c886d
commit
e626d080d7
8 files changed
+138
-85
No files matched your search
@@ -22,63 +22,83 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Micro event loop library
|
||||
* @file uev.h
|
||||
* @author Flemming Madsen (2012)
|
||||
* @author Joachim Wiberg (2013-2021)
|
||||
* @copyright MIT License
|
||||
*
|
||||
* The latest version of this manual and the libuEv software are
|
||||
* available at https://github.com/troglobit/libuEv/
|
||||
*/
|
||||
|
||||
#ifndef LIBUEV_UEV_H_
|
||||
#define LIBUEV_UEV_H_
|
||||
|
||||
#include "private.h"
|
||||
|
||||
/* Max. number of simulateneous events */
|
||||
#define UEV_MAX_EVENTS 10
|
||||
#define UEV_MAX_EVENTS 10 /**< Max. number of simulateneous events */
|
||||
|
||||
/* I/O events, signal and timer revents are always UEV_READ */
|
||||
#define UEV_NONE 0
|
||||
#define UEV_ERROR EPOLLERR
|
||||
#define UEV_READ EPOLLIN
|
||||
#define UEV_WRITE EPOLLOUT
|
||||
#define UEV_PRI EPOLLPRI
|
||||
#define UEV_HUP EPOLLHUP
|
||||
#define UEV_RDHUP EPOLLRDHUP
|
||||
#define UEV_EDGE EPOLLET
|
||||
#define UEV_ONESHOT EPOLLONESHOT
|
||||
#define UEV_NONE 0 /**< normal loop */
|
||||
#define UEV_ERROR EPOLLERR /**< error flag */
|
||||
#define UEV_READ EPOLLIN /**< poll for reading */
|
||||
#define UEV_WRITE EPOLLOUT /**< poll for writing */
|
||||
#define UEV_PRI EPOLLPRI /**< priority message */
|
||||
#define UEV_HUP EPOLLHUP /**< hangup event */
|
||||
#define UEV_RDHUP EPOLLRDHUP /**< peer shutdown */
|
||||
#define UEV_EDGE EPOLLET /**< edge triggered */
|
||||
#define UEV_ONESHOT EPOLLONESHOT /**< one-shot event */
|
||||
|
||||
/* Run flags */
|
||||
#define UEV_ONCE 1
|
||||
#define UEV_NONBLOCK 2
|
||||
#define UEV_ONCE 1 /**< run loop once */
|
||||
#define UEV_NONBLOCK 2 /**< exit if no event */
|
||||
|
||||
/* Macros */
|
||||
/** Check if I/O watcher is active or stopped */
|
||||
#define uev_io_active(w) _uev_watcher_active(w)
|
||||
/** Check if signal watcher is active or stopped */
|
||||
#define uev_signal_active(w) _uev_watcher_active(w)
|
||||
/** Check if timer is active or stopped */
|
||||
#define uev_timer_active(w) _uev_watcher_active(w)
|
||||
/** Check if cron timer watcher is active or stopped */
|
||||
#define uev_cron_active(w) _uev_watcher_active(w)
|
||||
/** Check if event watcher is active or stopped */
|
||||
#define uev_event_active(w) _uev_watcher_active(w)
|
||||
|
||||
/* Event watcher */
|
||||
/** Event loop context, need one per process and thread */
|
||||
typedef struct uev_ctx uev_ctx_t;
|
||||
|
||||
/** Event watcher */
|
||||
typedef struct uev {
|
||||
/* Private data for libuEv internal engine */
|
||||
uev_private_t type;
|
||||
|
||||
/* Public data for users to reference */
|
||||
int signo;
|
||||
int fd;
|
||||
uev_ctx_t *ctx;
|
||||
int signo; /**< configured signal */
|
||||
int fd; /**< active descriptor */
|
||||
uev_ctx_t *ctx; /**< watcher context */
|
||||
|
||||
/* Extra data for certain watcher types */
|
||||
struct signalfd_siginfo siginfo;
|
||||
struct signalfd_siginfo siginfo; /**< received signal */
|
||||
} uev_t;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
/**
|
||||
* Generic callback for watchers, @p 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 and peer shutdown events.
|
||||
*
|
||||
* Note: UEV_ERROR conditions must be handled by all callbacks!
|
||||
* I/O watchers may also need to check UEV_HUP. Appropriate action,
|
||||
* Note: ::UEV_ERROR conditions must be handled by all callbacks! I/O
|
||||
* watchers may also need to check ::UEV_HUP. Appropriate action,
|
||||
* e.g. restart the watcher, is up to the application and is thus
|
||||
* delegated to the callback.
|
||||
*/
|
||||
typedef void (uev_cb_t)(uev_t *w, void *arg, int events);
|
||||
|
||||
/* Public interface */
|
||||
|
||||
/** Create an event loop context */
|
||||
int uev_init (uev_ctx_t *ctx);
|
||||
int uev_init1 (uev_ctx_t *ctx, int maxevents);
|
||||
int uev_exit (uev_ctx_t *ctx);
|
||||
|
||||
Reference in new issue
Block a user