--- cvsroot/EV/EV.xs 2010/10/23 22:25:44 1.143 +++ cvsroot/EV/EV.xs 2010/10/28 04:59:35 1.147 @@ -122,6 +122,7 @@ *stash_check, *stash_embed, *stash_fork, + *stash_cleanup, *stash_async; ///////////////////////////////////////////////////////////////////////////// @@ -342,6 +343,11 @@ #define CHECK_SIG(sv,num) if ((num) < 0) \ croak ("illegal signal number or name: %s", SvPV_nolen (sv)); +EV_INLINE default_fork (void) +{ + ev_loop_fork (EV_DEFAULT_UC); +} + ///////////////////////////////////////////////////////////////////////////// // XS interface functions @@ -366,7 +372,7 @@ const_iv (EV_, READ) const_iv (EV_, WRITE) const_iv (EV_, IO) - const_iv (EV_, TIMEOUT) + const_iv (EV_, TIMER) const_iv (EV_, PERIODIC) const_iv (EV_, SIGNAL) const_iv (EV_, CHILD) @@ -376,6 +382,7 @@ const_iv (EV_, CHECK) const_iv (EV_, EMBED) const_iv (EV_, FORK) + const_iv (EV_, CLEANUP) const_iv (EV_, ASYNC) const_iv (EV_, CUSTOM) const_iv (EV_, ERROR) @@ -397,17 +404,15 @@ const_iv (EV, FLAG_FORKCHECK) const_iv (EV, FLAG_SIGNALFD) const_iv (EV, FLAG_NOENV) - const_iv (EV, FLAG_NOSIGFD) /* compatibility, always 0 */ const_iv (EV, FLAG_NOINOTIFY) const_iv (EV_, VERSION_MAJOR) const_iv (EV_, VERSION_MINOR) #if EV_COMPAT3 - const_iv (EV_, TIMER) - + const_iv (EV, FLAG_NOSIGFD) /* compatibility, always 0 */ + const_iv (EV_, TIMEOUT) const_iv (EV, LOOP_NONBLOCK) const_iv (EV, LOOP_ONESHOT) - const_iv (EV, UNLOOP_CANCEL) const_iv (EV, UNLOOP_ONE) const_iv (EV, UNLOOP_ALL) @@ -430,6 +435,7 @@ stash_embed = gv_stashpv ("EV::Embed" , 1); stash_stat = gv_stashpv ("EV::Stat" , 1); stash_fork = gv_stashpv ("EV::Fork" , 1); + stash_cleanup = gv_stashpv ("EV::Cleanup" , 1); stash_async = gv_stashpv ("EV::Async" , 1); { @@ -496,6 +502,8 @@ evapi.embed_sweep = ev_embed_sweep; evapi.fork_start = ev_fork_start; evapi.fork_stop = ev_fork_stop; + evapi.cleanup_start = ev_cleanup_start; + evapi.cleanup_stop = ev_cleanup_stop; evapi.async_start = ev_async_start; evapi.async_stop = ev_async_stop; evapi.async_send = ev_async_send; @@ -506,7 +514,7 @@ SvREADONLY_on (sv); } #if !defined(_WIN32) && !defined(_MINIX) - pthread_atfork (0, 0, ev_default_fork); + pthread_atfork (0, 0, default_fork); #endif } @@ -530,7 +538,7 @@ void ev_default_destroy () CODE: - ev_default_destroy (); + ev_loop_destroy (EV_DEFAULT_UC); SvREFCNT_dec (default_loop_sv); default_loop_sv = 0; @@ -715,6 +723,15 @@ OUTPUT: RETVAL +ev_cleanup *cleanup (SV *cb) + ALIAS: + cleanup_ns = 1 + CODE: + RETVAL = e_new (sizeof (ev_cleanup), cb, default_loop_sv); + ev_cleanup_set (RETVAL); + if (!ix) START (cleanup, RETVAL); + OUTPUT: + RETVAL ev_child *child (int pid, int trace, SV *cb) ALIAS: @@ -1105,6 +1122,27 @@ STOP (fork, w); e_destroy (w); +MODULE = EV PACKAGE = EV::Cleanup PREFIX = ev_cleanup_ + +void ev_cleanup_start (ev_cleanup *w) + CODE: + START (cleanup, w); + +void ev_cleanup_stop (ev_cleanup *w) + CODE: + STOP (cleanup, w); + +void DESTROY (ev_cleanup *w) + CODE: + STOP (cleanup, w); + e_destroy (w); + +int keepalive (ev_watcher *w, int new_value = 0) + CODE: + RETVAL = 0; + OUTPUT: + RETVAL + MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_ #if EV_CHILD_ENABLE @@ -1465,6 +1503,15 @@ OUTPUT: RETVAL +ev_cleanup *cleanup (struct ev_loop *loop, SV *cb) + ALIAS: + cleanup_ns = 1 + CODE: + RETVAL = e_new (sizeof (ev_cleanup), cb, ST (0)); + ev_cleanup_set (RETVAL); + if (!ix) START (cleanup, RETVAL); + OUTPUT: + RETVAL ev_child *child (struct ev_loop *loop, int pid, int trace, SV *cb) ALIAS: