apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1828492 - in /apr/apr/trunk: include/apr_reslist.h util-misc/apr_reslist.c
Date Fri, 06 Apr 2018 07:53:03 GMT
Author: ylavic
Date: Fri Apr  6 07:53:02 2018
New Revision: 1828492

URL: http://svn.apache.org/viewvc?rev=1828492&view=rev
Log:
reslist: follow up to r1828289: enfore empty list requirement when setting fifo.

The doxygen remark wasn't enough as noted by Ruediger.


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

Modified: apr/apr/trunk/include/apr_reslist.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_reslist.h?rev=1828492&r1=1828491&r2=1828492&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_reslist.h (original)
+++ apr/apr/trunk/include/apr_reslist.h Fri Apr  6 07:53:02 2018
@@ -136,17 +136,18 @@ APR_DECLARE(void) apr_reslist_timeout_se
                                           apr_interval_time_t timeout);
 
 /**
- * Set whether the reslist reuses resources as FIFO (First In First Out) or
- * LIFO (Last In First Out).
+ * 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).
- * @remark This function should be called before any resource is in the
- * the reslist, otherwise maintenance optimizations based on the expiration
- * time relative to the order of insertion (i.e. position in the list) won't
- * work as expected.
+ * @return APR_SUCCESS, or APR_EBUSY if the resource is not empty.
+ * @remark The reslist is required to be empty because some maintenance
+ * optimizations are based on the relative position of resources in the list
+ * to determine their expiry.
  *
  */
-APR_DECLARE(void) apr_reslist_fifo_set(apr_reslist_t *reslist, int fifo);
+APR_DECLARE(apr_status_t) apr_reslist_fifo_set(apr_reslist_t *reslist,
+                                               int fifo);
 
 /**
  * Return the number of outstanding resources.

Modified: apr/apr/trunk/util-misc/apr_reslist.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/util-misc/apr_reslist.c?rev=1828492&r1=1828491&r2=1828492&view=diff
==============================================================================
--- apr/apr/trunk/util-misc/apr_reslist.c (original)
+++ apr/apr/trunk/util-misc/apr_reslist.c Fri Apr  6 07:53:02 2018
@@ -445,9 +445,15 @@ APR_DECLARE(void) apr_reslist_timeout_se
     reslist->timeout = timeout;
 }
 
-APR_DECLARE(void) apr_reslist_fifo_set(apr_reslist_t *reslist, int fifo)
+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)



Mime
View raw message