Lely core libraries 2.3.4
poll.h
Go to the documentation of this file.
1
22#ifndef LELY_IO2_POSIX_POLL_H_
23#define LELY_IO2_POSIX_POLL_H_
24
25#include <lely/ev/poll.h>
26#include <lely/io2/ctx.h>
27#include <lely/io2/event.h>
28#include <lely/io2/sys/io.h>
29#include <lely/util/rbtree.h>
30
31struct io_poll_watch;
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
48typedef void io_poll_watch_func_t(struct io_poll_watch *watch, int events);
49
59 int _fd;
60 struct rbnode _node;
61 int _events;
62};
63
65#define IO_POLL_WATCH_INIT(func) \
66 { \
67 (func), -1, RBNODE_INIT, 0 \
68 }
69
70void *io_poll_alloc(void);
71void io_poll_free(void *ptr);
72io_poll_t *io_poll_init(io_poll_t *poll, io_ctx_t *ctx, int signo);
73void io_poll_fini(io_poll_t *poll);
74
87io_poll_t *io_poll_create(io_ctx_t *ctx, int signo);
88
90void io_poll_destroy(io_poll_t *poll);
91
97
103
124int io_poll_watch(io_poll_t *poll, int fd, int events,
125 struct io_poll_watch *watch);
126
127#ifdef __cplusplus
128}
129#endif
130
131#endif // !LELY_IO2_POSIX_POLL_H_
This header file is part of the I/O library; it contains the I/O context and service declarations.
This header file is part of the event library; it contains the abstract polling interface.
const struct ev_poll_vtbl *const ev_poll_t
The abstract polling interface.
Definition: poll.h:32
This header file is part of the I/O library; it contains the I/O event declarations.
This header file is part of the I/O library; it contains system-dependent I/O initialization/finaliza...
ev_poll_t * io_poll_get_poll(const io_poll_t *poll)
Returns a pointer to the ev_poll_t instance corresponding to the I/O polling instance.
Definition: poll.c:281
io_ctx_t * io_poll_get_ctx(const io_poll_t *poll)
Returns a pointer to the I/O context with which the I/O polling instance is registered.
Definition: poll.c:275
void io_poll_watch_func_t(struct io_poll_watch *watch, int events)
The type of function invoked by an I/O polling instance (through ev_poll_wait()) to report I/O events...
Definition: poll.h:48
int io_poll_watch(io_poll_t *poll, io_handle_t handle, struct io_event *event, int keep)
Registers an I/O device with an I/O polling interface and instructs it to watch for certain events.
Definition: poll.c:252
void io_poll_destroy(io_poll_t *poll)
Destroys an I/O polling interface.
Definition: poll.c:243
io_poll_t * io_poll_create(void)
Creates a new I/O polling interface.
Definition: poll.c:218
This header file is part of the utilities library; it contains the red-black tree declarations.
An I/O polling interface.
Definition: poll.c:51
Definition: ctx.c:38
An object representing a file descriptor being monitored for I/O events.
Definition: poll.h:56
io_poll_watch_func_t * func
A pointer to the function to be invoked when an I/O event occurs.
Definition: poll.h:58
A node in a red-black tree.
Definition: rbtree.h:53