1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include "poller.h"
#include <assert.h>
extern const struct poll_impl basic_poller_impl;
struct poller *poller_create(void) {
// TODO: Other poll impls
return basic_poller_impl.create();
}
int poller_destroy(struct poller *poller) {
assert(poller);
assert(poller->impl);
return poller->impl->destroy(poller);
}
struct event_source_fd *poller_add_fd(struct poller *poller, int fd, uint32_t mask,
event_source_fd_func_t func, void *data) {
assert(poller);
assert(poller->impl);
return poller->impl->add_fd(poller, fd, mask, func, data);
}
int event_source_fd_destroy(struct event_source_fd *event_source) {
assert(event_source);
assert(event_source->impl);
return event_source->impl->destroy(event_source);
}
struct event_source_signal *poller_add_signal(struct poller *poller, int signal,
event_source_signal_func_t func, void *data) {
assert(poller);
assert(poller->impl);
return poller->impl->add_signal(poller, signal, func, data);
}
int event_source_signal_destroy(struct event_source_signal *event_source) {
assert(event_source);
assert(event_source->impl);
return event_source->impl->destroy(event_source);
}
int event_source_fd_update(struct event_source_fd *event_source, uint32_t mask) {
assert(event_source);
assert(event_source->impl);
return event_source->impl->update(event_source, mask);
}
int poller_poll(struct poller *poller) {
assert(poller);
assert(poller->impl);
return poller->impl->poll(poller);
}
|