apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r749025 - /apr/apr/trunk/poll/unix/kqueue.c
Date Sun, 01 Mar 2009 13:05:33 GMT
Author: trawick
Date: Sun Mar  1 13:05:32 2009
New Revision: 749025

URL: http://svn.apache.org/viewvc?rev=749025&view=rev
Log:
get_kqueue_revent():
  tweak the code ever so slightly to highlight a critical kqueue()
  characteristic: POLLIN and POLLOUT won't be reflected in a single
  returned event

impl_pollset_remove():
  axe a redundant invocation of APR_RING_EMPTY()

other: trivial tweaks for consistency or readability

Modified:
    apr/apr/trunk/poll/unix/kqueue.c

Modified: apr/apr/trunk/poll/unix/kqueue.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/poll/unix/kqueue.c?rev=749025&r1=749024&r2=749025&view=diff
==============================================================================
--- apr/apr/trunk/poll/unix/kqueue.c (original)
+++ apr/apr/trunk/poll/unix/kqueue.c Sun Mar  1 13:05:32 2009
@@ -31,7 +31,7 @@
 
     if (event == EVFILT_READ)
         rv |= APR_POLLIN;
-    if (event == EVFILT_WRITE)
+    else if (event == EVFILT_WRITE)
         rv |= APR_POLLOUT;
     if (flags & EV_EOF)
         rv |= APR_POLLHUP;
@@ -74,7 +74,7 @@
                                         apr_pool_t *p,
                                         apr_uint32_t flags)
 {
-    apr_status_t rv = APR_SUCCESS;
+    apr_status_t rv;
     pollset->p = apr_palloc(p, sizeof(apr_pollset_private_t));
 #if APR_HAS_THREADS
     if (flags & APR_POLLSET_THREADSAFE &&
@@ -108,6 +108,7 @@
     pollset->p->kqueue_fd = kqueue();
 
     if (pollset->p->kqueue_fd == -1) {
+        pollset->p = NULL;
         return apr_get_netos_error();
     }
 
@@ -128,7 +129,7 @@
     APR_RING_INIT(&pollset->p->free_ring, pfd_elem_t, link);
     APR_RING_INIT(&pollset->p->dead_ring, pfd_elem_t, link);
 
-    return rv;
+    return APR_SUCCESS;
 }
 
 static apr_status_t impl_pollset_add(apr_pollset_t *pollset,
@@ -223,18 +224,16 @@
         }
     }
 
-    if (!APR_RING_EMPTY(&(pollset->p->query_ring), pfd_elem_t, link)) {
-        for (ep = APR_RING_FIRST(&(pollset->p->query_ring));
-             ep != APR_RING_SENTINEL(&(pollset->p->query_ring),
-                                     pfd_elem_t, link);
-             ep = APR_RING_NEXT(ep, link)) {
-
-            if (descriptor->desc.s == ep->pfd.desc.s) {
-                APR_RING_REMOVE(ep, link);
-                APR_RING_INSERT_TAIL(&(pollset->p->dead_ring),
-                                     ep, pfd_elem_t, link);
-                break;
-            }
+    for (ep = APR_RING_FIRST(&(pollset->p->query_ring));
+         ep != APR_RING_SENTINEL(&(pollset->p->query_ring),
+                                 pfd_elem_t, link);
+         ep = APR_RING_NEXT(ep, link)) {
+
+        if (descriptor->desc.s == ep->pfd.desc.s) {
+            APR_RING_REMOVE(ep, link);
+            APR_RING_INSERT_TAIL(&(pollset->p->dead_ring),
+                                 ep, pfd_elem_t, link);
+            break;
         }
     }
 
@@ -299,7 +298,7 @@
 
     pollset_lock_rings();
 
-    /* Shift all PFDs in the Dead Ring to be Free Ring */
+    /* Shift all PFDs in the Dead Ring to the Free Ring */
     APR_RING_CONCAT(&(pollset->p->free_ring), &(pollset->p->dead_ring),
                     pfd_elem_t, link);
 
@@ -326,7 +325,6 @@
     return APR_SUCCESS;
 }
 
-
 static apr_status_t impl_pollcb_create(apr_pollcb_t *pollcb,
                                        apr_uint32_t size,
                                        apr_pool_t *p,



Mime
View raw message