]> git.llucax.com Git - software/libev.git/commitdiff
make libev safer w.r.t. reentrancy
authorroot <root>
Wed, 31 Oct 2007 16:29:52 +0000 (16:29 +0000)
committerroot <root>
Wed, 31 Oct 2007 16:29:52 +0000 (16:29 +0000)
ev.c

diff --git a/ev.c b/ev.c
index f580a888374dde75fdc507a3bfe248feb35c692f..246b38ff75b8aa5c13ac29249d8fcf3948fb807e 100644 (file)
--- a/ev.c
+++ b/ev.c
@@ -418,11 +418,9 @@ fd_reify (void)
 static void
 call_pending ()
 {
 static void
 call_pending ()
 {
-  int i;
-
-  for (i = 0; i < pendingcnt; ++i)
+  while (pendingcnt)
     {
     {
-      ANPENDING *p = pendings + i;
+      ANPENDING *p = pendings + --pendingcnt;
 
       if (p->w)
         {
 
       if (p->w)
         {
@@ -430,8 +428,6 @@ call_pending ()
           p->w->cb (p->w, p->events);
         }
     }
           p->w->cb (p->w, p->events);
         }
     }
-
-  pendingcnt = 0;
 }
 
 static void
 }
 
 static void