… | |
… | |
29 | #define EV_STANDALONE 1 |
29 | #define EV_STANDALONE 1 |
30 | #define EV_PROTOTYPES 1 |
30 | #define EV_PROTOTYPES 1 |
31 | #define EV_USE_NANOSLEEP EV_USE_MONOTONIC |
31 | #define EV_USE_NANOSLEEP EV_USE_MONOTONIC |
32 | #define EV_USE_FLOOR 1 |
32 | #define EV_USE_FLOOR 1 |
33 | #define EV_API_STATIC |
33 | #define EV_API_STATIC |
34 | #define EV_H <ev.h> |
34 | #define EV_H "../libev/ev.h" |
35 | #define EV_CONFIG_H error |
35 | #define EV_CONFIG_H error |
36 | #include "EV/EVAPI.h" |
36 | #include "EV/EVAPI.h" |
37 | |
37 | |
38 | #define EV_SELECT_IS_WINSOCKET 0 |
38 | #define EV_SELECT_IS_WINSOCKET 0 |
39 | #ifdef _WIN32 |
39 | #ifdef _WIN32 |
… | |
… | |
42 | # define fd_mask Perl_fd_mask |
42 | # define fd_mask Perl_fd_mask |
43 | #endif |
43 | #endif |
44 | /* due to bugs in OS X we have to use libev/ explicitly here */ |
44 | /* due to bugs in OS X we have to use libev/ explicitly here */ |
45 | #include "libev/ev.c" |
45 | #include "libev/ev.c" |
46 | |
46 | |
47 | #if !defined _WIN32 && !defined _MINIX && !EV_NO_ATFORK |
47 | #if !defined _WIN32 && !defined __minix && !EV_NO_ATFORK |
48 | # include <pthread.h> |
48 | # include <pthread.h> |
49 | #endif |
49 | #endif |
50 | |
50 | |
51 | #define e_loop(w) INT2PTR (struct ev_loop *, SvIVX (((ev_watcher *)(w))->loop)) |
51 | #define e_loop(w) INT2PTR (struct ev_loop *, SvIVX (((ev_watcher *)(w))->loop)) |
52 | #define e_flags(w) ((ev_watcher *)(w))->e_flags |
52 | #define e_flags(w) ((ev_watcher *)(w))->e_flags |
… | |
… | |
202 | dSP; |
202 | dSP; |
203 | I32 mark = SP - PL_stack_base; |
203 | I32 mark = SP - PL_stack_base; |
204 | SV *sv_self, *sv_events; |
204 | SV *sv_self, *sv_events; |
205 | |
205 | |
206 | /* libev might have stopped the watcher */ |
206 | /* libev might have stopped the watcher */ |
207 | if (expect_false (w->e_flags & WFLAG_UNREFED) |
207 | if (ecb_expect_false (w->e_flags & WFLAG_UNREFED) |
208 | && !ev_is_active (w)) |
208 | && !ev_is_active (w)) |
209 | REF (w); |
209 | REF (w); |
210 | |
210 | |
211 | if (expect_true (sv_self_cache)) |
211 | if (ecb_expect_true (sv_self_cache)) |
212 | { |
212 | { |
213 | sv_self = sv_self_cache; sv_self_cache = 0; |
213 | sv_self = sv_self_cache; sv_self_cache = 0; |
214 | SvRV_set (sv_self, SvREFCNT_inc_NN (w->self)); |
214 | SvRV_set (sv_self, SvREFCNT_inc_NN (w->self)); |
215 | } |
215 | } |
216 | else |
216 | else |
217 | { |
217 | { |
218 | sv_self = newRV_inc (w->self); /* e_self (w) MUST be blessed by now */ |
218 | sv_self = newRV_inc (w->self); /* e_self (w) MUST be blessed by now */ |
219 | SvREADONLY_on (sv_self); |
219 | SvREADONLY_on (sv_self); |
220 | } |
220 | } |
221 | |
221 | |
222 | if (expect_true (sv_events_cache)) |
222 | if (ecb_expect_true (sv_events_cache)) |
223 | { |
223 | { |
224 | sv_events = sv_events_cache; sv_events_cache = 0; |
224 | sv_events = sv_events_cache; sv_events_cache = 0; |
225 | SvIV_set (sv_events, revents); |
225 | SvIV_set (sv_events, revents); |
226 | SvIOK_only (sv_events); |
226 | SvIOK_only (sv_events); |
227 | } |
227 | } |
… | |
… | |
237 | PUSHs (sv_events); |
237 | PUSHs (sv_events); |
238 | |
238 | |
239 | PUTBACK; |
239 | PUTBACK; |
240 | call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL); |
240 | call_sv (w->cb_sv, G_DISCARD | G_VOID | G_EVAL); |
241 | |
241 | |
242 | if (expect_false (SvREFCNT (sv_self) != 1 || sv_self_cache)) |
242 | if (ecb_expect_false (SvREFCNT (sv_self) != 1 || sv_self_cache)) |
243 | SvREFCNT_dec (sv_self); |
243 | SvREFCNT_dec (sv_self); |
244 | else |
244 | else |
245 | { |
245 | { |
246 | SvREFCNT_dec (SvRV (sv_self)); |
246 | SvREFCNT_dec (SvRV (sv_self)); |
247 | SvRV_set (sv_self, &PL_sv_undef); |
247 | SvRV_set (sv_self, &PL_sv_undef); |
248 | sv_self_cache = sv_self; |
248 | sv_self_cache = sv_self; |
249 | } |
249 | } |
250 | |
250 | |
251 | if (expect_false (SvREFCNT (sv_events) != 1 || sv_events_cache)) |
251 | if (ecb_expect_false (SvREFCNT (sv_events) != 1 || sv_events_cache)) |
252 | SvREFCNT_dec (sv_events); |
252 | SvREFCNT_dec (sv_events); |
253 | else |
253 | else |
254 | sv_events_cache = sv_events; |
254 | sv_events_cache = sv_events; |
255 | |
255 | |
256 | if (expect_false (SvTRUE (ERRSV))) |
256 | if (ecb_expect_false (SvTRUE (ERRSV))) |
257 | { |
257 | { |
258 | SPAGAIN; |
258 | SPAGAIN; |
259 | PUSHMARK (SP); |
259 | PUSHMARK (SP); |
260 | PUTBACK; |
260 | PUTBACK; |
261 | call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); |
261 | call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); |
… | |
… | |
995 | CODE: |
995 | CODE: |
996 | { |
996 | { |
997 | RETVAL = w->events; |
997 | RETVAL = w->events; |
998 | |
998 | |
999 | if (items > 1) |
999 | if (items > 1) |
1000 | RESET (io, w, (w, w->fd, new_events)); |
1000 | { |
|
|
1001 | int active = ev_is_active (w); |
|
|
1002 | if (active) STOP (io, w); |
|
|
1003 | ev_io_modify (w, new_events); |
|
|
1004 | if (active) START (io, w); |
|
|
1005 | } |
1001 | } |
1006 | } |
1002 | OUTPUT: |
1007 | OUTPUT: |
1003 | RETVAL |
1008 | RETVAL |
1004 | |
1009 | |
1005 | MODULE = EV PACKAGE = EV::Signal PREFIX = ev_signal_ |
1010 | MODULE = EV PACKAGE = EV::Signal PREFIX = ev_signal_ |