OSSP CVS Repository

ossp - Difference in ossp-pkg/pth/pth_event.c versions 1.59 and 1.60
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/pth/pth_event.c 1.59 -> 1.60

--- pth_event.c  2002/10/24 15:21:13     1.59
+++ pth_event.c  2002/11/05 19:39:09     1.60
@@ -34,7 +34,7 @@
 struct pth_event_st {
     struct pth_event_st *ev_next;
     struct pth_event_st *ev_prev;
-    int ev_occurred;
+    pth_status_t ev_status;
     int ev_type;
     int ev_goal;
     union {
@@ -108,7 +108,7 @@
     }
 
     /* initialize common ingredients */
-    ev->ev_occurred = FALSE;
+    ev->ev_status = PTH_STATUS_PENDING;
 
     /* initialize event specific ingredients */
     if (spec & PTH_EVENT_FD) {
@@ -330,12 +330,12 @@
     return ring;
 }
 
-/* determine whether the event is occurred */
-int pth_event_occurred(pth_event_t ev)
+/* determine status of the event */
+pth_status_t pth_event_status(pth_event_t ev)
 {
     if (ev == NULL)
         return pth_error(FALSE, EINVAL);
-    return ev->ev_occurred;
+    return ev->ev_status;
 }
 
 /* walk to next or previous event in an event ring */
@@ -350,7 +350,7 @@
             ev = ev->ev_prev;
         else
             return pth_error((pth_event_t)NULL, EINVAL);
-    } while ((direction & PTH_UNTIL_OCCURRED) && !(ev->ev_occurred));
+    } while ((direction & PTH_UNTIL_OCCURRED) && (ev->ev_status != PTH_STATUS_OCCURRED));
     return ev;
 }
 
@@ -381,7 +381,7 @@
 /* wait for one or more events */
 int pth_wait(pth_event_t ev_ring)
 {
-    int occurred;
+    int nonpending;
     pth_event_t ev;
 
     /* at least a waiting ring is required */
@@ -389,10 +389,10 @@
         return pth_error(-1, EINVAL);
     pth_debug2("pth_wait: enter from thread \"%s\"", pth_current->name);
 
-    /* mark all events in waiting ring as still not occurred */
+    /* mark all events in waiting ring as still pending */
     ev = ev_ring;
     do {
-        ev->ev_occurred = FALSE;
+        ev->ev_status = PTH_STATUS_PENDING;
         pth_debug2("pth_wait: waiting on event 0x%lx", (unsigned long)ev);
         ev = ev->ev_next;
     } while (ev != ev_ring);
@@ -411,19 +411,19 @@
     /* unlink event ring from current thread */
     pth_current->events = NULL;
 
-    /* count number of actually occurred events */
+    /* count number of actually occurred (or failed) events */
     ev = ev_ring;
-    occurred = 0;
+    nonpending = 0;
     do {
-        if (ev->ev_occurred) {
-            pth_debug2("pth_wait: occurred event 0x%lx", (unsigned long)ev);
-            occurred++;
+        if (ev->ev_status != PTH_STATUS_PENDING) {
+            pth_debug2("pth_wait: non-pending event 0x%lx", (unsigned long)ev);
+            nonpending++;
         }
         ev = ev->ev_next;
     } while (ev != ev_ring);
 
     /* leave to current thread with number of occurred events */
     pth_debug2("pth_wait: leave to thread \"%s\"", pth_current->name);
-    return occurred;
+    return nonpending;
 }
 

CVSTrac 2.0.1