--- libev/ev.c 2012/05/06 19:29:59 1.427 +++ libev/ev.c 2012/05/08 15:44:09 1.428 @@ -204,6 +204,7 @@ # include # define WIN32_LEAN_AND_MEAN # include +# include # ifndef EV_SELECT_IS_WINSOCKET # define EV_SELECT_IS_WINSOCKET 1 # endif @@ -2579,10 +2580,12 @@ { verify_watcher (EV_A_ (W)w); - if (++j & 1) - w2 = w2->next; + if (j++ & 1) + { + assert (("libev: io watcher list contains a loop", w != w2)); + w2 = w2->next; + } - assert (("libev: io watcher list contains a loop", w != w2)); assert (("libev: inactive fd watcher on anfd list", ev_active (w) == 1)); assert (("libev: fd mismatch between watcher and anfd", ((ev_io *)w)->fd == i)); }