]> hackdaworld.org Git - my-code/api.git/commitdiff
fixed select/timeval bug in event api
authorhackbard <hackbard>
Fri, 5 Nov 2004 11:46:07 +0000 (11:46 +0000)
committerhackbard <hackbard>
Fri, 5 Nov 2004 11:46:07 +0000 (11:46 +0000)
event/event.c

index 398a1ddc5ba930c96c7b39247585a54bea741d79..90f9fa7e8d5c07e2ea369e423f125bc416712671 100644 (file)
@@ -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;
     }