… | |
… | |
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" |
… | |
… | |
25 | |
27 | |
26 | ev.h |
28 | ev.h |
27 | ev.c |
29 | ev.c |
28 | ev_vars.h |
30 | ev_vars.h |
29 | ev_wrap.h |
31 | ev_wrap.h |
|
|
32 | ev_win32.c |
|
|
33 | |
30 | ev_select.c only when select backend is enabled (which is by default) |
34 | ev_select.c only when select backend is enabled (which is by default) |
31 | 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) |
32 | 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) |
33 | 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) |
34 | |
38 | |
35 | "ev.c" includes the backend files directly when enabled. |
39 | "ev.c" includes the backend files directly when enabled. |
|
|
40 | |
|
|
41 | LIBEVENT COMPATIBILITY API |
36 | |
42 | |
37 | To include the libevent compatibility API, also include: |
43 | To include the libevent compatibility API, also include: |
38 | |
44 | |
39 | #include "event.c" |
45 | #include "event.c" |
40 | |
46 | |
… | |
… | |
84 | If undefined or defined to be "1", libev will compile in support |
90 | If undefined or defined to be "1", libev will compile in support |
85 | for the select(2) backend. No attempt at autodetection will be |
91 | for the select(2) backend. No attempt at autodetection will be |
86 | done: if no other method takes over, select will be it. Otherwise |
92 | done: if no other method takes over, select will be it. Otherwise |
87 | the select backend will not be compiled in. |
93 | the select backend will not be compiled in. |
88 | |
94 | |
|
|
95 | EV_SELECT_USE_WIN32_HANDLES |
|
|
96 | |
|
|
97 | When defined to 1, the select backend will assume that select |
|
|
98 | doesn't understand file descriptors but wants osf handles on |
|
|
99 | win32 (this is the case when the select to be used is the winsock |
|
|
100 | select). This means that it will call _get_osfhandle on the fd to |
|
|
101 | convert it to an OS handle. Should not be defined on non-win32 |
|
|
102 | platforms. |
|
|
103 | |
89 | EV_USE_POLL |
104 | EV_USE_POLL |
90 | |
105 | |
91 | If defined to be "1", libev will compile in support for the poll(2) |
106 | If defined to be "1", libev will compile in support for the poll(2) |
92 | backend. No attempt at autodetection will be done. poll usually |
107 | backend. No attempt at autodetection will be done. poll usually |
93 | performs worse than select, so its not enabled by default (it is |
108 | performs worse than select, so its not enabled by default (it is |
… | |
… | |
118 | |
133 | |
119 | For example, the perl EV module uses this: |
134 | For example, the perl EV module uses this: |
120 | |
135 | |
121 | #define EV_COMMON \ |
136 | #define EV_COMMON \ |
122 | SV *self; /* contains this struct */ \ |
137 | SV *self; /* contains this struct */ \ |
123 | SV *cb_sv, *fh; |
138 | SV *cb_sv, *fh /* note no trailing ";" */ |
124 | |
139 | |
125 | EV_PROTOTYPES |
140 | EV_PROTOTYPES |
126 | |
141 | |
127 | If defined to be "0", then "ev.h" will not define any function |
142 | If defined to be "0", then "ev.h" will not define any function |
128 | prototypes, but still define all the structs and other |
143 | prototypes, but still define all the structs and other |
… | |
… | |
140 | EXAMPLES |
155 | EXAMPLES |
141 | |
156 | |
142 | For a real-world example of a program the includes libev |
157 | For a real-world example of a program the includes libev |
143 | verbatim, you can have a look at the EV perl module |
158 | verbatim, you can have a look at the EV perl module |
144 | (http://software.schmorp.de/pkg/EV.html). It has the libev files in |
159 | (http://software.schmorp.de/pkg/EV.html). It has the libev files in |
145 | the liev/ subdirectory and includes them in the EV/EVAPI.h (public |
160 | the libev/ subdirectory and includes them in the EV/EVAPI.h (public |
146 | interface) and EV.xs (implementation) files. Only EV.xs file will be |
161 | interface) and EV.xs (implementation) files. Only the EV.xs file will |
147 | compiled. |
162 | be compiled. |
148 | |
163 | |