ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.23 by root, Wed Oct 31 20:10:17 2007 UTC vs.
Revision 1.24 by root, Wed Oct 31 20:46:44 2007 UTC

197 event (events [i], type); 197 event (events [i], type);
198} 198}
199 199
200/* called on EBADF to verify fds */ 200/* called on EBADF to verify fds */
201static void 201static void
202fd_recheck () 202fd_recheck (void)
203{ 203{
204 int fd; 204 int fd;
205 205
206 for (fd = 0; fd < anfdmax; ++fd) 206 for (fd = 0; fd < anfdmax; ++fd)
207 if (anfds [fd].wev) 207 if (anfds [fd].wev)
208 if (fcntl (fd, F_GETFD) == -1 && errno == EBADF) 208 if (fcntl (fd, F_GETFD) == -1 && errno == EBADF)
209 while (anfds [fd].head) 209 while (anfds [fd].head)
210 {
211 event ((W)anfds [fd].head, EV_ERROR);
210 evio_stop (anfds [fd].head); 212 evio_stop (anfds [fd].head);
213 }
211} 214}
212 215
213/*****************************************************************************/ 216/*****************************************************************************/
214 217
215static struct ev_timer **timers; 218static struct ev_timer **timers;
371# include "ev_epoll.c" 374# include "ev_epoll.c"
372#endif 375#endif
373#if HAVE_SELECT 376#if HAVE_SELECT
374# include "ev_select.c" 377# include "ev_select.c"
375#endif 378#endif
379
380int
381ev_version_major (void)
382{
383 return EV_VERSION_MAJOR;
384}
385
386int
387ev_version_minor (void)
388{
389 return EV_VERSION_MINOR;
390}
376 391
377int ev_init (int flags) 392int ev_init (int flags)
378{ 393{
379 if (!ev_method) 394 if (!ev_method)
380 { 395 {
414 return ev_method; 429 return ev_method;
415} 430}
416 431
417/*****************************************************************************/ 432/*****************************************************************************/
418 433
434void
419void ev_prefork (void) 435ev_prefork (void)
420{ 436{
421 /* nop */ 437 /* nop */
422} 438}
423 439
440void
424void ev_postfork_parent (void) 441ev_postfork_parent (void)
425{ 442{
426 /* nop */ 443 /* nop */
427} 444}
428 445
446void
429void ev_postfork_child (void) 447ev_postfork_child (void)
430{ 448{
431#if HAVE_EPOLL 449#if HAVE_EPOLL
432 if (ev_method == EVMETHOD_EPOLL) 450 if (ev_method == EVMETHOD_EPOLL)
433 epoll_postfork_child (); 451 epoll_postfork_child ();
434#endif 452#endif
467 485
468 fdchangecnt = 0; 486 fdchangecnt = 0;
469} 487}
470 488
471static void 489static void
472call_pending () 490call_pending (void)
473{ 491{
474 while (pendingcnt) 492 while (pendingcnt)
475 { 493 {
476 ANPENDING *p = pendings + --pendingcnt; 494 ANPENDING *p = pendings + --pendingcnt;
477 495
482 } 500 }
483 } 501 }
484} 502}
485 503
486static void 504static void
487timers_reify () 505timers_reify (void)
488{ 506{
489 while (timercnt && timers [0]->at <= now) 507 while (timercnt && timers [0]->at <= now)
490 { 508 {
491 struct ev_timer *w = timers [0]; 509 struct ev_timer *w = timers [0];
492 510
503 evtimer_stop (w); /* nonrepeating: stop timer */ 521 evtimer_stop (w); /* nonrepeating: stop timer */
504 } 522 }
505} 523}
506 524
507static void 525static void
508periodics_reify () 526periodics_reify (void)
509{ 527{
510 while (periodiccnt && periodics [0]->at <= ev_now) 528 while (periodiccnt && periodics [0]->at <= ev_now)
511 { 529 {
512 struct ev_periodic *w = periodics [0]; 530 struct ev_periodic *w = periodics [0];
513 531
549 } 567 }
550 } 568 }
551} 569}
552 570
553static void 571static void
554time_update () 572time_update (void)
555{ 573{
556 int i; 574 int i;
557 575
558 ev_now = ev_time (); 576 ev_now = ev_time ();
559 577

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines