--- cvsroot/EV/EV.xs 2007/11/01 11:11:39 1.32 +++ cvsroot/EV/EV.xs 2007/11/01 13:33:12 1.35 @@ -5,7 +5,6 @@ /*#include */ #define TIMEOUT_NONE HUGE_VAL -#define EV_USE_EPOLL 1 #define EV_PROTOTYPES 1 #include "EV/EVAPI.h" @@ -85,6 +84,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) { @@ -293,6 +301,8 @@ sv_setiv (sv, (IV)&evapi); SvREADONLY_on (sv); } + + pthread_atfork (ev_fork_prepare, ev_fork_parent, ev_fork_child); } NV ev_now () @@ -438,6 +448,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: @@ -500,6 +511,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: @@ -529,6 +541,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: @@ -552,6 +565,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: @@ -573,6 +587,7 @@ void DESTROY (struct ev_idle *w) CODE: ev_idle_stop (w); + e_destroy (w); MODULE = EV PACKAGE = EV::Prepare PREFIX = ev_check_ @@ -583,6 +598,7 @@ void DESTROY (struct ev_prepare *w) CODE: ev_prepare_stop (w); + e_destroy (w); MODULE = EV PACKAGE = EV::Check PREFIX = ev_check_ @@ -593,6 +609,7 @@ void DESTROY (struct ev_check *w) CODE: ev_check_stop (w); + e_destroy (w); MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_ @@ -603,6 +620,7 @@ void DESTROY (struct ev_child *w) CODE: ev_child_stop (w); + e_destroy (w); void set (struct ev_child *w, int pid) CODE: