libevent 2.2.1
Event notification library
Loading...
Searching...
No Matches
watch.h
Go to the documentation of this file.
1/*
2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that the following conditions
4 * are met:
5 * 1. Redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer.
7 * 2. Redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution.
10 * 3. The name of the author may not be used to endorse or promote products
11 * derived from this software without specific prior written permission.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24#ifndef EVENT2_WATCH_H_INCLUDED_
25#define EVENT2_WATCH_H_INCLUDED_
26
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43#include <event2/visibility.h>
44
45struct event_base;
46struct evwatch;
47struct evwatch_prepare_cb_info;
48struct evwatch_check_cb_info;
49struct timeval;
50
59typedef void (*evwatch_prepare_cb)(struct evwatch *, const struct evwatch_prepare_cb_info *, void *);
60
69typedef void (*evwatch_check_cb)(struct evwatch *, const struct evwatch_check_cb_info *, void *);
70
81EVENT2_EXPORT_SYMBOL
82struct evwatch *evwatch_prepare_new(struct event_base *base, evwatch_prepare_cb callback, void *arg);
83
94EVENT2_EXPORT_SYMBOL
95struct evwatch *evwatch_check_new(struct event_base *base, evwatch_check_cb callback, void *arg);
96
103EVENT2_EXPORT_SYMBOL
104struct event_base *evwatch_base(struct evwatch *watcher);
105
114EVENT2_EXPORT_SYMBOL
115void evwatch_free(struct evwatch *watcher);
116
129EVENT2_EXPORT_SYMBOL
130int evwatch_prepare_get_timeout(const struct evwatch_prepare_cb_info *info, struct timeval *timeout);
131
132#ifdef __cplusplus
133}
134#endif
135
136#endif /* EVENT2_WATCH_H_INCLUDED_ */
Structure to hold information and state for a Libevent dispatch loop.
Definition event.h:221
void(* evwatch_check_cb)(struct evwatch *, const struct evwatch_check_cb_info *, void *)
Check callback, invoked by event_base_loop immediately after polling for I/O and before processing an...
Definition watch.h:69
EVENT2_EXPORT_SYMBOL int evwatch_prepare_get_timeout(const struct evwatch_prepare_cb_info *info, struct timeval *timeout)
Get the timeout (the expected polling duration) passed to the underlying implementation's dispatch.
EVENT2_EXPORT_SYMBOL struct evwatch * evwatch_check_new(struct event_base *base, evwatch_check_cb callback, void *arg)
Register a new "check" watcher, to be called in the event loop after polling for events and before ha...
EVENT2_EXPORT_SYMBOL struct event_base * evwatch_base(struct evwatch *watcher)
Get the event_base that a given evwatch is registered with.
EVENT2_EXPORT_SYMBOL struct evwatch * evwatch_prepare_new(struct event_base *base, evwatch_prepare_cb callback, void *arg)
Register a new "prepare" watcher, to be called in the event loop prior to polling for events.
EVENT2_EXPORT_SYMBOL void evwatch_free(struct evwatch *watcher)
Deregister and deallocate a watcher.
void(* evwatch_prepare_cb)(struct evwatch *, const struct evwatch_prepare_cb_info *, void *)
Prepare callback, invoked by event_base_loop immediately before polling for I/O.
Definition watch.h:59