summaryrefslogtreecommitdiff
path: root/poll
diff options
context:
space:
mode:
authorpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2005-03-12 00:14:38 +0000
committerpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2005-03-12 00:14:38 +0000
commitc77fca6aaf22a1b36620d186338deff8222f694b (patch)
treec997a1629183c86d09e361bbb8feb465b2ece94a /poll
parent598f5f8fcb053e56e42d96b15d862072163550d7 (diff)
downloadlibapr-c77fca6aaf22a1b36620d186338deff8222f694b.tar.gz
Replace looping code with an O(1) APR_RING_CONCAT.
This also fixes a problem on Solaris 10 with the Event Ports. Karma to Justin for telling me about APR_RING_CONCAT. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@157183 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll')
-rw-r--r--poll/unix/epoll.c6
-rw-r--r--poll/unix/kqueue.c6
-rw-r--r--poll/unix/port.c6
3 files changed, 3 insertions, 15 deletions
diff --git a/poll/unix/epoll.c b/poll/unix/epoll.c
index 06ad713ce..d2b61433d 100644
--- a/poll/unix/epoll.c
+++ b/poll/unix/epoll.c
@@ -257,11 +257,7 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
pollset_lock_rings();
/* Shift all PFDs in the Dead Ring to be Free Ring */
- while (!APR_RING_EMPTY(&(pollset->dead_ring), pfd_elem_t, link)) {
- ep = APR_RING_FIRST(&(pollset->dead_ring));
- APR_RING_REMOVE(ep, link);
- APR_RING_INSERT_TAIL(&(pollset->free_ring), ep, pfd_elem_t, link);
- }
+ APR_RING_CONCAT(&(pollset->free_ring), &(pollset->dead_ring), pfd_elem_t, link);
pollset_unlock_rings();
diff --git a/poll/unix/kqueue.c b/poll/unix/kqueue.c
index bb73240b4..287ab18fb 100644
--- a/poll/unix/kqueue.c
+++ b/poll/unix/kqueue.c
@@ -275,11 +275,7 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
pollset_lock_rings();
/* Shift all PFDs in the Dead Ring to be Free Ring */
- while (!APR_RING_EMPTY(&(pollset->dead_ring), pfd_elem_t, link)) {
- ep = APR_RING_FIRST(&(pollset->dead_ring));
- APR_RING_REMOVE(ep, link);
- APR_RING_INSERT_TAIL(&(pollset->free_ring), ep, pfd_elem_t, link);
- }
+ APR_RING_CONCAT(&(pollset->free_ring), &(pollset->dead_ring), pfd_elem_t, link);
pollset_unlock_rings();
diff --git a/poll/unix/port.c b/poll/unix/port.c
index 244ec362d..f2350ee99 100644
--- a/poll/unix/port.c
+++ b/poll/unix/port.c
@@ -329,11 +329,7 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
pollset_lock_rings();
/* Shift all PFDs in the Dead Ring to be Free Ring */
- while (!APR_RING_EMPTY(&(pollset->dead_ring), pfd_elem_t, link)) {
- ep = APR_RING_FIRST(&(pollset->dead_ring));
- APR_RING_REMOVE(ep, link);
- APR_RING_INSERT_TAIL(&(pollset->free_ring), ep, pfd_elem_t, link);
- }
+ APR_RING_CONCAT(&(pollset->free_ring), &(pollset->dead_ring), pfd_elem_t, link);
pollset_unlock_rings();