mirror of
https://github.com/troglobit/libuev.git
synced 2026-10-01 05:22:25 +07:00
New uev_*_active() API: check if watcher is active
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -81,11 +81,12 @@ struct uev;
|
||||
uev_type_t
|
||||
|
||||
/* Internal API for dealing with generic watchers */
|
||||
int uev_watcher_init (uev_ctx_t *ctx, struct uev *w, uev_type_t type,
|
||||
void (*cb)(struct uev *, void *, int), void *arg,
|
||||
int fd, int events);
|
||||
int uev_watcher_start(struct uev *w);
|
||||
int uev_watcher_stop (struct uev *w);
|
||||
int uev_watcher_init (uev_ctx_t *ctx, struct uev *w, uev_type_t type,
|
||||
void (*cb)(struct uev *, void *, int), void *arg,
|
||||
int fd, int events);
|
||||
int uev_watcher_start (struct uev *w);
|
||||
int uev_watcher_stop (struct uev *w);
|
||||
int uev_watcher_active(struct uev *w);
|
||||
|
||||
#endif /* LIBUEV_PRIVATE_H_ */
|
||||
|
||||
|
||||
@@ -124,6 +124,15 @@ int uev_watcher_stop(uev_t *w)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Private to libuEv, do not use directly! */
|
||||
int uev_watcher_active(uev_t *w)
|
||||
{
|
||||
if (!w)
|
||||
return 0;
|
||||
|
||||
return w->active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event loop context
|
||||
* @param ctx Pointer to an uev_ctx_t context to be initialized
|
||||
|
||||
@@ -41,6 +41,12 @@
|
||||
#define UEV_ONCE 1
|
||||
#define UEV_NONBLOCK 2
|
||||
|
||||
/* Macros */
|
||||
#define uev_io_active(w) uev_watcher_active(w)
|
||||
#define uev_timer_active(w) uev_watcher_active(w)
|
||||
#define uev_cron_active(w) uev_watcher_active(w)
|
||||
#define uev_signal_active(w) uev_watcher_active(w)
|
||||
|
||||
/* Event watcher */
|
||||
typedef struct uev {
|
||||
/* Private data for libuEv internal engine */
|
||||
|
||||
Reference in New Issue
Block a user