You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2018/04/13 21:02:00 UTC

svn commit: r1829102 - in /apr/apr/trunk: CHANGES include/apr_reslist.h util-misc/apr_reslist.c

Author: ylavic
Date: Fri Apr 13 21:02:00 2018
New Revision: 1829102

URL: http://svn.apache.org/viewvc?rev=1829102&view=rev
Log:
evert apr_reslist_fifo_set() (r1828289 and follow ups).

Will re-implement the feature through apr_reslist_acquire_fifo(), as
proposed by Bill.


Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/include/apr_reslist.h
    apr/apr/trunk/util-misc/apr_reslist.c

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=1829102&r1=1829101&r2=1829102&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Fri Apr 13 21:02:00 2018
@@ -4,9 +4,6 @@ Changes for APR 2.0.0
   *) apr_file_write: Optimize large reads from buffered files on Windows.
      [Evgeny Kotkov]
 
-  *) reslist: Add apr_reslist_fifo_set() to allow for reusing resources
-     in FIFO mode instead of the default LIFO mode.  [Yann Ylavic]
-
   *) Add apr_pool_tag_get to retrieve the pool tag name.  [Joe Orton]
 
   *) Add apr_sockaddr_zone_set, apr_sockaddr_zone_set to set and retrieve

Modified: apr/apr/trunk/include/apr_reslist.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_reslist.h?rev=1829102&r1=1829101&r2=1829102&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_reslist.h (original)
+++ apr/apr/trunk/include/apr_reslist.h Fri Apr 13 21:02:00 2018
@@ -136,20 +136,6 @@ APR_DECLARE(void) apr_reslist_timeout_se
                                           apr_interval_time_t timeout);
 
 /**
- * Set whether the reslist should maintain resources as FIFO (First In First
- * Out) or LIFO (Last In First Out).
- * @param reslist The resource list.
- * @param fifo Set as FIFO (non zero) or LIFO (zero).
- * @return APR_SUCCESS, or APR_EBUSY if the reslist is not empty.
- * @remark The reslist is required to be empty because some maintenance
- * optimizations are based on the relative positions of resources in the
- * list to determine their expiry.
- *
- */
-APR_DECLARE(apr_status_t) apr_reslist_fifo_set(apr_reslist_t *reslist,
-                                               int fifo);
-
-/**
  * Return the number of outstanding resources.
  * @param reslist The resource list.
  */

Modified: apr/apr/trunk/util-misc/apr_reslist.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/util-misc/apr_reslist.c?rev=1829102&r1=1829101&r2=1829102&view=diff
==============================================================================
--- apr/apr/trunk/util-misc/apr_reslist.c (original)
+++ apr/apr/trunk/util-misc/apr_reslist.c Fri Apr 13 21:02:00 2018
@@ -58,7 +58,6 @@ struct apr_reslist_t {
     apr_thread_mutex_t *listlock;
     apr_thread_cond_t *avail;
 #endif
-    int fifo;
 };
 
 /**
@@ -81,12 +80,7 @@ static apr_res_t *pop_resource(apr_resli
  */
 static void push_resource(apr_reslist_t *reslist, apr_res_t *resource)
 {
-    if (reslist->fifo) {
-        APR_RING_INSERT_TAIL(&reslist->avail_list, resource, apr_res_t, link);
-    }
-    else {
-        APR_RING_INSERT_HEAD(&reslist->avail_list, resource, apr_res_t, link);
-    }
+    APR_RING_INSERT_HEAD(&reslist->avail_list, resource, apr_res_t, link);
     resource->freed = apr_time_now();
     reslist->nidle++;
 }
@@ -229,13 +223,8 @@ APR_DECLARE(apr_status_t) apr_reslist_ma
     /* Check if we need to expire old resources */
     now = apr_time_now();
     while (reslist->nidle > reslist->smax && reslist->nidle > 0) {
-        /* Peek at the next expiring resource in the list */
-        if (reslist->fifo) {
-            res = APR_RING_FIRST(&reslist->avail_list);
-        }
-        else {
-            res = APR_RING_LAST(&reslist->avail_list);
-        }
+        /* Peak at the last resource in the list */
+        res = APR_RING_LAST(&reslist->avail_list);
         /* See if the oldest entry should be expired */
         if (now - res->freed < reslist->ttl) {
             /* If this entry is too young, none of the others
@@ -445,17 +434,6 @@ APR_DECLARE(void) apr_reslist_timeout_se
     reslist->timeout = timeout;
 }
 
-APR_DECLARE(apr_status_t) apr_reslist_fifo_set(apr_reslist_t *reslist,
-                                               int fifo)
-{
-    if (!APR_RING_EMPTY(&reslist->avail_list, apr_res_t, link)) {
-        return APR_EBUSY;
-    }
-
-    reslist->fifo = fifo;
-    return APR_SUCCESS;
-}
-
 APR_DECLARE(apr_uint32_t) apr_reslist_acquired_count(apr_reslist_t *reslist)
 {
     apr_uint32_t count;