ext/libev/event.c in passenger-4.0.20 vs ext/libev/event.c in passenger-4.0.21

- old
+ new

@@ -1,9 +1,9 @@ /* * libevent compatibility layer * - * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de> + * Copyright (c) 2007,2008,2009,2010,2012 Marc Alexander Lehmann <libev@schmorp.de> * All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: * @@ -76,17 +76,19 @@ } #define EVENT_STRINGIFY(s) # s #define EVENT_VERSION(a,b) EVENT_STRINGIFY (a) "." EVENT_STRINGIFY (b) -const char *event_get_version (void) +const char * +event_get_version (void) { /* returns ABI, not API or library, version */ return EVENT_VERSION (EV_VERSION_MAJOR, EV_VERSION_MINOR); } -const char *event_get_method (void) +const char * +event_get_method (void) { return "libev"; } void *event_init (void) @@ -103,10 +105,27 @@ #endif return ev_x_cur; } +const char * +event_base_get_method (const struct event_base *base) +{ + return "libev"; +} + +struct event_base * +event_base_new (void) +{ +#if EV_MULTIPLICITY + return (struct event_base *)ev_loop_new (EVFLAG_AUTO); +#else + assert (("libev: multiple event bases not supported when not compiled with EV_MULTIPLICITY")); + return NULL; +#endif +} + void event_base_free (struct event_base *base) { dLOOPbase; #if EV_MULTIPLICITY @@ -135,10 +154,16 @@ int event_loopexit (struct timeval *tv) { return event_base_loopexit (ev_x_cur, tv); } +event_callback_fn event_get_callback +(const struct event *ev) +{ + return ev->ev_callback; +} + static void ev_x_cb (struct event *ev, int revents) { revents &= EV_READ | EV_WRITE | EV_TIMER | EV_SIGNAL; @@ -330,12 +355,10 @@ int event_base_loop (struct event_base *base, int flags) { dLOOPbase; - ev_run (EV_A_ flags); - - return 0; + return !ev_run (EV_A_ flags); } int event_base_dispatch (struct event_base *base) { return event_base_loop (base, 0);