--- cvsroot/EV/EV.xs 2010/04/14 00:17:22 1.138 +++ cvsroot/EV/EV.xs 2010/10/24 17:58:41 1.144 @@ -31,7 +31,7 @@ /* due to bugs in OS X we have to use libev/ explicitly here */ #include "libev/ev.c" -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(_MINIX) # include #endif @@ -366,8 +366,7 @@ const_iv (EV_, READ) const_iv (EV_, WRITE) const_iv (EV_, IO) - const_iv (EV_, TIMEOUT) /* deprecated */ - const_iv (EV_, TIMER) + const_iv (EV_, TIMEOUT) const_iv (EV_, PERIODIC) const_iv (EV_, SIGNAL) const_iv (EV_, CHILD) @@ -381,13 +380,12 @@ const_iv (EV_, CUSTOM) const_iv (EV_, ERROR) - 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) + const_iv (EV, RUN_NOWAIT) + const_iv (EV, RUN_ONCE) + const_iv (EV, BREAK_CANCEL) + const_iv (EV, BREAK_ONE) + const_iv (EV, BREAK_ALL) const_iv (EV, BACKEND_SELECT) const_iv (EV, BACKEND_POLL) const_iv (EV, BACKEND_EPOLL) @@ -404,6 +402,16 @@ const_iv (EV_, VERSION_MAJOR) const_iv (EV_, VERSION_MINOR) +#if EV_COMPAT3 + const_iv (EV_, TIMER) + + 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) +#endif }; for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) @@ -450,7 +458,7 @@ evapi.suspend = ev_suspend; evapi.resume = ev_resume; evapi.backend = ev_backend; - evapi.unloop = ev_unloop; + evapi.break_ = ev_break; evapi.invoke_pending = ev_invoke_pending; evapi.pending_count = ev_pending_count; evapi.verify = ev_verify; @@ -458,7 +466,7 @@ evapi.set_invoke_pending_cb= ev_set_invoke_pending_cb; evapi.ref = ev_ref; evapi.unref = ev_unref; - evapi.loop = ev_loop; + evapi.run = ev_run; evapi.once = ev_once; evapi.io_start = ev_io_start; evapi.io_stop = ev_io_stop; @@ -476,8 +484,10 @@ evapi.prepare_stop = ev_prepare_stop; evapi.check_start = ev_check_start; evapi.check_stop = ev_check_stop; +#if EV_CHILD_ENABLE evapi.child_start = ev_child_start; evapi.child_stop = ev_child_stop; +#endif evapi.stat_start = ev_stat_start; evapi.stat_stop = ev_stat_stop; evapi.stat_stat = ev_stat_stat; @@ -495,7 +505,7 @@ sv_setiv (sv, (IV)&evapi); SvREADONLY_on (sv); } -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(_MINIX) pthread_atfork (0, 0, ev_default_fork); #endif } @@ -520,7 +530,7 @@ void ev_default_destroy () CODE: - ev_default_destroy (); + ev_loop_destroy (EV_DEFAULT_UC); SvREFCNT_dec (default_loop_sv); default_loop_sv = 0; @@ -550,12 +560,18 @@ C_ARGS: evapi.default_loop void ev_verify () + ALIAS: + loop_verify = 1 C_ARGS: evapi.default_loop unsigned int ev_iteration () + ALIAS: + loop_count = 1 C_ARGS: evapi.default_loop unsigned int ev_depth () + ALIAS: + loop_depth = 1 C_ARGS: evapi.default_loop void ev_set_io_collect_interval (NV interval) @@ -564,10 +580,14 @@ void ev_set_timeout_collect_interval (NV interval) C_ARGS: evapi.default_loop, interval -void ev_loop (int flags = 0) +void ev_run (int flags = 0) + ALIAS: + loop = 1 C_ARGS: evapi.default_loop, flags -void ev_unloop (int how = EVUNLOOP_ONE) +void ev_break (int how = EVBREAK_ONE) + ALIAS: + unloop = 1 C_ARGS: evapi.default_loop, how void ev_feed_fd_event (int fd, int revents = EV_NONE) @@ -695,16 +715,22 @@ OUTPUT: RETVAL + ev_child *child (int pid, int trace, SV *cb) ALIAS: child_ns = 1 CODE: +#if EV_CHILD_ENABLE RETVAL = e_new (sizeof (ev_child), cb, default_loop_sv); ev_child_set (RETVAL, pid, trace); if (!ix) START (child, RETVAL); +#else + croak ("EV::child watchers not supported on this platform"); +#endif OUTPUT: RETVAL + ev_stat *stat (SV *path, NV interval, SV *cb) ALIAS: stat_ns = 1 @@ -1081,6 +1107,8 @@ MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_ +#if EV_CHILD_ENABLE + void ev_child_start (ev_child *w) CODE: START (child, w); @@ -1109,6 +1137,8 @@ OUTPUT: RETVAL +#endif + MODULE = EV PACKAGE = EV::Stat PREFIX = ev_stat_ void ev_stat_start (ev_stat *w) @@ -1275,13 +1305,13 @@ void DESTROY (struct ev_loop *loop) CODE: - if (loop != evapi.default_loop) /* global destruction sucks */ + /* 1. the default loop shouldn't be freed by destroying it'S pelr loop object */ + /* 2. not doing so helps avoid many global destruction bugs in perl, too */ + if (loop != evapi.default_loop) ev_loop_destroy (loop); void ev_loop_fork (struct ev_loop *loop) -void ev_verify (struct ev_loop *loop) - NV ev_now (struct ev_loop *loop) void ev_now_update (struct ev_loop *loop) @@ -1296,13 +1326,25 @@ unsigned int ev_backend (struct ev_loop *loop) +void ev_verify (struct ev_loop *loop) + ALIAS: + loop_verify = 1 + unsigned int ev_iteration (struct ev_loop *loop) + ALIAS: + loop_count = 1 unsigned int ev_depth (struct ev_loop *loop) + ALIAS: + loop_depth = 1 -void ev_loop (struct ev_loop *loop, int flags = 0) +void ev_run (struct ev_loop *loop, int flags = 0) + ALIAS: + loop = 1 -void ev_unloop (struct ev_loop *loop, int how = 1) +void ev_break (struct ev_loop *loop, int how = 1) + ALIAS: + unloop = 1 void ev_feed_fd_event (struct ev_loop *loop, int fd, int revents = EV_NONE) @@ -1423,13 +1465,18 @@ OUTPUT: RETVAL + ev_child *child (struct ev_loop *loop, int pid, int trace, SV *cb) ALIAS: child_ns = 1 CODE: +#if EV_CHILD_ENABLE RETVAL = e_new (sizeof (ev_child), cb, ST (0)); ev_child_set (RETVAL, pid, trace); if (!ix) START (child, RETVAL); +#else + croak ("EV::child watchers not supported on this platform"); +#endif OUTPUT: RETVAL