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
|
#pragma once
#include <al/lib.h>
#include <al/macros.h>
#define EV_MULTIPLICITY 1
#define EV_STAT_ENABLE 0
#define EV_PERIODIC_ENABLE 0
#define EV_SIGNAL_ENABLE 0
#define EV_CHILD_ENABLE 0
#define EV_IDLE_ENABLE 0
#define EV_PREPARE_ENABLE 0
#define EV_FORK_ENABLE 0
#define EV_CLEANUP_ENABLE 0
#define EV_EMBED_ENABLE 0
#include <ev.h>
// Wrap common libev macros to ignore aliasing warnings.
AL_IGNORE_WARNING("-Wstrict-aliasing")
static inline void ev_init_nn(ev_watcher *ev, void (*callback)(struct ev_loop *, ev_watcher *, s32))
{
ev_init(ev, callback);
}
#define ev_init_n(w, callback) ev_init_nn((ev_watcher *)w, (void (*)(struct ev_loop *, ev_watcher *, s32))callback)
static inline bool ev_is_active_nn(ev_watcher *ev)
{
return ev_is_active(ev);
}
#define ev_is_active_n(w) ev_is_active_nn((ev_watcher *)w)
static inline void ev_io_init_n(ev_io *io, void (*callback)(struct ev_loop *, ev_io *, s32), s32 fd, s32 events)
{
ev_io_init(io, callback, fd, events);
}
static inline void ev_timer_init_n(ev_timer *timer, void (*callback)(struct ev_loop *, ev_timer *, s32), s32 fd, s32 events)
{
ev_timer_init(timer, callback, fd, events);
}
static inline void ev_async_init_n(ev_async *asyn, void (*callback)(struct ev_loop *, ev_async *, s32))
{
ev_async_init(asyn, callback);
}
AL_IGNORE_WARNING_END
|