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

Comparing libev/ev.c (file contents):
Revision 1.424 by root, Tue May 1 22:01:40 2012 UTC vs.
Revision 1.426 by root, Sun May 6 13:42:10 2012 UTC

1430 w_->pending = ++pendingcnt [pri]; 1430 w_->pending = ++pendingcnt [pri];
1431 array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, EMPTY2); 1431 array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, EMPTY2);
1432 pendings [pri][w_->pending - 1].w = w_; 1432 pendings [pri][w_->pending - 1].w = w_;
1433 pendings [pri][w_->pending - 1].events = revents; 1433 pendings [pri][w_->pending - 1].events = revents;
1434 } 1434 }
1435
1436 pendingpri = NUMPRI - 1;
1435} 1437}
1436 1438
1437inline_speed void 1439inline_speed void
1438feed_reverse (EV_P_ W w) 1440feed_reverse (EV_P_ W w)
1439{ 1441{
2552#if EV_FEATURE_API 2554#if EV_FEATURE_API
2553void ecb_cold 2555void ecb_cold
2554ev_verify (EV_P) EV_THROW 2556ev_verify (EV_P) EV_THROW
2555{ 2557{
2556#if EV_VERIFY 2558#if EV_VERIFY
2557 int i; 2559 int i, j;
2558 WL w; 2560 WL w, w2;
2559 2561
2560 assert (activecnt >= -1); 2562 assert (activecnt >= -1);
2561 2563
2562 assert (fdchangemax >= fdchangecnt); 2564 assert (fdchangemax >= fdchangecnt);
2563 for (i = 0; i < fdchangecnt; ++i) 2565 for (i = 0; i < fdchangecnt; ++i)
2564 assert (("libev: negative fd in fdchanges", fdchanges [i] >= 0)); 2566 assert (("libev: negative fd in fdchanges", fdchanges [i] >= 0));
2565 2567
2566 assert (anfdmax >= 0); 2568 assert (anfdmax >= 0);
2567 for (i = 0; i < anfdmax; ++i) 2569 for (i = j = 0; i < anfdmax; ++i)
2568 for (w = anfds [i].head; w; w = w->next) 2570 for (w = w2 = anfds [i].head; w; w = w->next)
2569 { 2571 {
2570 verify_watcher (EV_A_ (W)w); 2572 verify_watcher (EV_A_ (W)w);
2573
2574 if (++j & 1)
2575 w2 = w2->next;
2576
2577 assert (("libev: io watcher list contains a loop", w != w2));
2571 assert (("libev: inactive fd watcher on anfd list", ev_active (w) == 1)); 2578 assert (("libev: inactive fd watcher on anfd list", ev_active (w) == 1));
2572 assert (("libev: fd mismatch between watcher and anfd", ((ev_io *)w)->fd == i)); 2579 assert (("libev: fd mismatch between watcher and anfd", ((ev_io *)w)->fd == i));
2573 } 2580 }
2574 2581
2575 assert (timermax >= timercnt); 2582 assert (timermax >= timercnt);
2685} 2692}
2686 2693
2687void noinline 2694void noinline
2688ev_invoke_pending (EV_P) 2695ev_invoke_pending (EV_P)
2689{ 2696{
2690 int pri; 2697 for (pendingpri = NUMPRI; pendingpri--; ) /* pendingpri is modified during the loop */
2691
2692 for (pri = NUMPRI; pri--; )
2693 while (pendingcnt [pri]) 2698 while (pendingcnt [pendingpri])
2694 { 2699 {
2695 ANPENDING *p = pendings [pri] + --pendingcnt [pri]; 2700 ANPENDING *p = pendings [pendingpri] + --pendingcnt [pendingpri];
2696 2701
2697 p->w->pending = 0; 2702 p->w->pending = 0;
2698 EV_CB_INVOKE (p->w, p->events); 2703 EV_CB_INVOKE (p->w, p->events);
2699 EV_FREQUENT_CHECK; 2704 EV_FREQUENT_CHECK;
2700 } 2705 }
3249 EV_FREQUENT_CHECK; 3254 EV_FREQUENT_CHECK;
3250 3255
3251 ev_start (EV_A_ (W)w, 1); 3256 ev_start (EV_A_ (W)w, 1);
3252 array_needsize (ANFD, anfds, anfdmax, fd + 1, array_init_zero); 3257 array_needsize (ANFD, anfds, anfdmax, fd + 1, array_init_zero);
3253 wlist_add (&anfds[fd].head, (WL)w); 3258 wlist_add (&anfds[fd].head, (WL)w);
3259
3260 /* common bug, apparently */
3261 assert (("libev: ev_io_start called with corrupted watcher", ((WL)w)->next != (WL)w));
3254 3262
3255 fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY); 3263 fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
3256 w->events &= ~EV__IOFDSET; 3264 w->events &= ~EV__IOFDSET;
3257 3265
3258 EV_FREQUENT_CHECK; 3266 EV_FREQUENT_CHECK;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines