… | |
… | |
5 | into your source tree. |
5 | into your source tree. |
6 | |
6 | |
7 | This is how it works: |
7 | This is how it works: |
8 | |
8 | |
9 | FILESETS |
9 | FILESETS |
|
|
10 | |
|
|
11 | CORE EVENT LOOP |
10 | |
12 | |
11 | To include only the libev core (all the ev_* functions): |
13 | To include only the libev core (all the ev_* functions): |
12 | |
14 | |
13 | #define EV_STANDALONE 1 |
15 | #define EV_STANDALONE 1 |
14 | #include "ev.c" |
16 | #include "ev.c" |
… | |
… | |
33 | ev_poll.c only when poll backend is enabled (disabled by default) |
35 | ev_poll.c only when poll backend is enabled (disabled by default) |
34 | ev_epoll.c only when the epoll backend is enabled (disabled by default) |
36 | ev_epoll.c only when the epoll backend is enabled (disabled by default) |
35 | ev_kqueue.c only when the kqueue backend is enabled (disabled by default) |
37 | ev_kqueue.c only when the kqueue backend is enabled (disabled by default) |
36 | |
38 | |
37 | "ev.c" includes the backend files directly when enabled. |
39 | "ev.c" includes the backend files directly when enabled. |
|
|
40 | |
|
|
41 | LIBEVENT COMPATIBILITY API |
38 | |
42 | |
39 | To include the libevent compatibility API, also include: |
43 | To include the libevent compatibility API, also include: |
40 | |
44 | |
41 | #include "event.c" |
45 | #include "event.c" |
42 | |
46 | |
… | |
… | |
120 | |
124 | |
121 | For example, the perl EV module uses this: |
125 | For example, the perl EV module uses this: |
122 | |
126 | |
123 | #define EV_COMMON \ |
127 | #define EV_COMMON \ |
124 | SV *self; /* contains this struct */ \ |
128 | SV *self; /* contains this struct */ \ |
125 | SV *cb_sv, *fh; |
129 | SV *cb_sv, *fh /* note no trailing ";" */ |
126 | |
130 | |
127 | EV_PROTOTYPES |
131 | EV_PROTOTYPES |
128 | |
132 | |
129 | If defined to be "0", then "ev.h" will not define any function |
133 | If defined to be "0", then "ev.h" will not define any function |
130 | prototypes, but still define all the structs and other |
134 | prototypes, but still define all the structs and other |
… | |
… | |
142 | EXAMPLES |
146 | EXAMPLES |
143 | |
147 | |
144 | For a real-world example of a program the includes libev |
148 | For a real-world example of a program the includes libev |
145 | verbatim, you can have a look at the EV perl module |
149 | verbatim, you can have a look at the EV perl module |
146 | (http://software.schmorp.de/pkg/EV.html). It has the libev files in |
150 | (http://software.schmorp.de/pkg/EV.html). It has the libev files in |
147 | the liev/ subdirectory and includes them in the EV/EVAPI.h (public |
151 | the libev/ subdirectory and includes them in the EV/EVAPI.h (public |
148 | interface) and EV.xs (implementation) files. Only EV.xs file will be |
152 | interface) and EV.xs (implementation) files. Only the EV.xs file will |
149 | compiled. |
153 | be compiled. |
150 | |
154 | |