From: hackbard Date: Fri, 5 Nov 2004 11:46:07 +0000 (+0000) Subject: fixed select/timeval bug in event api X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=912bc7231be6eeb538095b729c87dfd09a12b6ad;p=my-code%2Fapi.git fixed select/timeval bug in event api --- diff --git a/event/event.c b/event/event.c index 398a1dd..90f9fa7 100644 --- a/event/event.c +++ b/event/event.c @@ -54,6 +54,7 @@ int event_start(t_event *event,void *ptr, int s_ret; struct timeval tv; + struct timeval *tv_ptr; /* switch on event system */ event->status=ENABLED; @@ -64,8 +65,11 @@ int event_start(t_event *event,void *ptr, event->wfds=event->wfds_o; tv=event->timeout; + if((tv.tv_sec==0)&&(tv.tv_usec==0)) tv_ptr=NULL; + else tv_ptr=&tv; + if((s_ret=select(event->maxfd+1,&(event->rfds),&(event->wfds),NULL, - &tv))==-1) { + tv_ptr))==-1) { perror("[event] select call"); return E_ERROR; }