comparison lib/poll.c @ 15353:f3753e923660

poll: do not return 0 on timeout=-1 * lib/poll.c: Loop with yield if no events occured
author Erik Faye-Lund <kusmabite@gmail.com>
date Wed, 06 Jul 2011 12:10:51 +0200
parents 97fc9a21a8fb
children b86e9061a6d0
comparison
equal deleted inserted replaced
15352:c089b67729fe 15353:f3753e923660
450 } 450 }
451 451
452 if (!hEvent) 452 if (!hEvent)
453 hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); 453 hEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
454 454
455 restart:
455 handle_array[0] = hEvent; 456 handle_array[0] = hEvent;
456 nhandles = 1; 457 nhandles = 1;
457 FD_ZERO (&rfds); 458 FD_ZERO (&rfds);
458 FD_ZERO (&wfds); 459 FD_ZERO (&wfds);
459 FD_ZERO (&xfds); 460 FD_ZERO (&xfds);
590 591
591 if ((pfd[i].revents |= happened) != 0) 592 if ((pfd[i].revents |= happened) != 0)
592 rc++; 593 rc++;
593 } 594 }
594 595
596 if (!rc && timeout == INFTIM)
597 {
598 SwitchToThread();
599 goto restart;
600 }
601
595 return rc; 602 return rc;
596 #endif 603 #endif
597 } 604 }