--- EV/EV.xs 2007/11/01 11:11:21 1.31 +++ EV/EV.xs 2007/11/01 17:45:30 1.38 @@ -4,13 +4,13 @@ /*#include */ -#define TIMEOUT_NONE HUGE_VAL -#define EV_USE_EPOLL 1 - #define EV_PROTOTYPES 1 #include "EV/EVAPI.h" #include "libev/ev.c" +#include "libev/event.h" +#include "libev/event.c" +#include "libev/evdns.c" typedef int Signal; @@ -85,6 +85,15 @@ return (void *)w; } +static void * +e_destroy (void *w_) +{ + struct ev_watcher *w = w_; + + SvREFCNT_dec (w->fh ); w->fh = 0; + SvREFCNT_dec (w->cb_sv); w->cb_sv = 0; +} + static SV * e_bless (struct ev_watcher *w, HV *stash) { @@ -110,8 +119,6 @@ SV *sv_self, *sv_events, *sv_status = 0; static SV *sv_events_cache; - fprintf (stderr, "e_cb %p,%x\n", w, revents);//D - sv_self = newRV_inc (w->self); /* w->self MUST be blessed by now */ if (sv_events_cache) @@ -151,7 +158,6 @@ } } -#if 0 ///////////////////////////////////////////////////////////////////////////// // DNS @@ -203,7 +209,6 @@ LEAVE; } -#endif #define CHECK_REPEAT(repeat) if (repeat < 0.) \ croak (# repeat " value must be >= 0"); @@ -295,6 +300,8 @@ sv_setiv (sv, (IV)&evapi); SvREADONLY_on (sv); } + + pthread_atfork (ev_fork_prepare, ev_fork_parent, ev_fork_child); } NV ev_now () @@ -440,6 +447,7 @@ void DESTROY (struct ev_io *w) CODE: ev_io_stop (w); + e_destroy (w); void set (struct ev_io *w, SV *fh, int events) CODE: @@ -475,7 +483,7 @@ OUTPUT: RETVAL -short events (struct ev_io *w, short new_events = EV_UNDEF) +int events (struct ev_io *w, int new_events = EV_UNDEF) CODE: { RETVAL = w->events; @@ -502,6 +510,7 @@ void DESTROY (struct ev_signal *w) CODE: ev_signal_stop (w); + e_destroy (w); void set (struct ev_signal *w, SV *signal = 0) CODE: @@ -531,6 +540,7 @@ void DESTROY (struct ev_timer *w) CODE: ev_timer_stop (w); + e_destroy (w); void set (struct ev_timer *w, NV after, NV repeat = 0.) INIT: @@ -554,6 +564,7 @@ void DESTROY (struct ev_periodic *w) CODE: ev_periodic_stop (w); + e_destroy (w); void set (struct ev_periodic *w, NV at, NV interval = 0.) INIT: @@ -575,6 +586,7 @@ void DESTROY (struct ev_idle *w) CODE: ev_idle_stop (w); + e_destroy (w); MODULE = EV PACKAGE = EV::Prepare PREFIX = ev_check_ @@ -585,6 +597,7 @@ void DESTROY (struct ev_prepare *w) CODE: ev_prepare_stop (w); + e_destroy (w); MODULE = EV PACKAGE = EV::Check PREFIX = ev_check_ @@ -595,6 +608,7 @@ void DESTROY (struct ev_check *w) CODE: ev_check_stop (w); + e_destroy (w); MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_ @@ -605,6 +619,7 @@ void DESTROY (struct ev_child *w) CODE: ev_child_stop (w); + e_destroy (w); void set (struct ev_child *w, int pid) CODE: @@ -621,8 +636,6 @@ OUTPUT: RETVAL -#if 0 - MODULE = EV PACKAGE = EV::DNS PREFIX = evdns_ BOOT: @@ -714,6 +727,7 @@ void evdns_search_ndots_set (int ndots) +#if 0 MODULE = EV PACKAGE = EV::HTTP PREFIX = evhttp_