10 #define EVENT_SELECT_TIMEOUT (50000) 48 #define event_select_handler_pull(this, data) dputil_list_pull((DPUtilList)(this), (DPUtilListData)(data)) 49 #define event_select_handler_insert(this, prev, data) dputil_list_insert((DPUtilList)(this),(DPUtilListData)(prev), (DPUtilListData)(data)) 79 if(!instance)
return NULL;
115 current = current->
next;
120 if(base->
tail == instance) {
157 if(base->
tail == instance) {
202 handler = base->
tail;
217 handler=handler->
prev;
238 if(!instance)
return;
struct event_select_fds_t event_select_fds_t
static void event_select_reset_fds(event_select_fds_t *fds)
struct event_select_handler_t * EventSelectHandler
EventHandler event_if_add(EventInstance this, EventSubscriber subscriber, void *arg)
add new event
event_select_fds_t waitfds
void(* free)(EventInstance this)
void event_if_del(EventInstance this, EventHandler handler)
delete event
int event_if_getfd(EventHandler handler)
get fd related to handler
int event_if_loop(EventInstance this)
main loop of this event
void event_if_free(EventInstance this)
free event if instance
void(* event_callback)(int socketfd, int eventflag, void *event_arg)
void * EventHandler
Event handler related to fd.
event_select_fds_t storefds
struct event_select_t * EventSelect
void * event_if_update(EventInstance this, EventHandler handler, EventSubscriber subscriber, void *arg)
update registered event
EventInstance event_if_new(void)
event new
EventSubscriber class instance definition, this is storaged in any threads.
static void event_select_set_fds(EventSelect this, EventSubscriber subscriber)
#define EVENT_SELECT_TIMEOUT
static int event_select_get_eventflag_from_fds(EventSelect this, int fd)
#define event_select_handler_insert(this, prev, data)
int eventflag
OR value of EV_TPOOL_XXX definition.
int fd
file descripter of this subscriber
static void event_select_unset_fds(EventSelect this, EventSubscriber subscriber)
void * EventInstance
Event management instance which get from event_if_new.
#define DEBUG_ERRPRINT(...)
void event_if_exit(EventInstance this)
exit after main loop
#define event_select_handler_pull(this, data)
struct timeval use_timeout
event_subscriber_t subscriber
void event_if_loopbreak(EventInstance this)
break event