40 #include <sys/eventfd.h> 76 is_stop = this->is_stop;
96 handler->
watch.data = handler;
107 if(!instance)
return NULL;
109 instance->
loop = ev_loop_new(0);
110 if(!instance->
loop)
goto err;
175 ev_unloop (
base->
loop, EVUNLOOP_ONE);
void * event_if_update(EventInstance this, EventHandler handler, EventSubscriber subscriber, void *arg)
update registered event
void(* event_callback)(int socketfd, int eventflag, void *event_arg)
void event_if_free(EventInstance this)
free event if instance
int event_if_getfd(EventHandler handler)
get fd related to handler
void(* free)(EventInstance this)
int event_if_loop(EventInstance this)
main loop to wait event
static int event_if_is_stop(EventLibevManager this)
static int convert_etpoll_eveid2own(int eventflag)
void(* event_callback)(int socketfd, int eventflag, void *event_arg)
EventHandler event_if_add(EventInstance this, EventSubscriber subscriber, void *arg)
add new event
void * EventHandler
Event handler related to fd.
EventSubscriber class instance definition, this is storaged in any threads.
struct event_libev_handler_t * EventLibevHandler
int eventflag
OR value of EV_TPOOL_XXX definition.
void event_if_del(EventInstance this, EventHandler handler)
delete event
int fd
file descripter of this subscriber
void * EventInstance
Event management instance which get from event_if_new.
struct event_libev_manager_t * EventLibevManager
#define DEBUG_ERRPRINT(...)
static void event_if_subscribe_cb(EV_P_ ev_io *w, int revents)
EventInstance event_if_new(void)
event new
static int convert_etpoll_own2eveid(int eventflag)
static void event_if_libev_handler_init(EventLibevManager base, EventLibevHandler handler, EventSubscriber subscriber, void *arg)
void event_if_loopbreak(EventInstance this)
break event
void event_if_exit(EventInstance this)
exit after main loop