From: hackbard Date: Thu, 2 Jun 2005 21:24:06 +0000 (+0000) Subject: added evnt_check funtion X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=46249e03c15b7882fe4bbbaf49c7997fca12761f;p=my-code%2Fapi.git added evnt_check funtion --- diff --git a/event/event.c b/event/event.c index 90f9fa7..2685168 100644 --- a/event/event.c +++ b/event/event.c @@ -93,6 +93,13 @@ int event_start(t_event *event,void *ptr, return E_SUCCESS; } +int event_check(t_event *event,int fd) { + + if(FD_ISSET(fd,&(event->wfds))|FD_ISSET(fd,&(event->rfds))) return E_FD_YES; + else return E_FD_NO; + +} + int event_stop(t_event *event) { dprintf(event->outfd,"[event] shutdown\n"); diff --git a/event/event.h b/event/event.h index aadd65f..1ea0759 100644 --- a/event/event.h +++ b/event/event.h @@ -15,6 +15,8 @@ #define CALLBACK_ERROR -1 #define E_ERROR -1 #define E_SUCCESS 1 +#define E_FD_YES 2 +#define E_FD_NO 3 /* event status */ #define DISABLED 0 @@ -44,6 +46,7 @@ int event_math(int fd,t_event *event,char rw,char ar); int event_start(t_event *event,void *ptr, int (*callback0)(t_event *event,void *ptr), int (*callback1)(t_event *event,void *ptr)); +int event_check(t_event *event,int fd); int event_stop(t_event *event); #endif